refactor(executor/people): 加 executorList 兜底, SQL 硬编码 unit_type='executor' (跟 sponsor 同模式)

- mapper BizPersonMapper.xml 新增 selectExecutorList, SQL 内硬编码 unit_type + parent_user_id=当前主账号
- controller 加 GET /business/person/executorList
- service / mapper 接口同步声明 selectExecutorList
- 前端 api/business/person.js 加 listExecutorPerson
- executor/People.vue 改调 listExecutorPerson, 删 bizList + unitType 参数

效果: executor 端人员列表也走专属接口, 前端传 unitType 绕不开 SQL 兜底
This commit is contained in:
郭庆泰
2026-08-18 01:42:05 +08:00
parent ce9de7c880
commit 50c2678ec6
7 changed files with 57 additions and 5 deletions
@@ -79,6 +79,19 @@ public class BizPersonController extends BaseController
List<BizPerson> list = bizPersonService.selectSponsorList(bizPerson); List<BizPerson> list = bizPersonService.selectSponsorList(bizPerson);
return getDataTable(list); return getDataTable(list);
} }
/**
* executor 端专属人员列表 (同 sponsor: SQL 硬编码 unit_type='executor' + parent_user_id=当前主账号, 前端绕不开)
*/
@GetMapping("/executorList")
public TableDataInfo executorList(BizPerson bizPerson)
{
Long mainUid = getUserId();
bizPerson.getParams().put("executorOwnerUid", mainUid);
startPage();
List<BizPerson> list = bizPersonService.selectExecutorList(bizPerson);
return getDataTable(list);
}
@GetMapping("/{personId}") @GetMapping("/{personId}")
public AjaxResult getInfo(@PathVariable("personId") String personId) public AjaxResult getInfo(@PathVariable("personId") String personId)
{ {
@@ -11,6 +11,8 @@ public interface BizPersonMapper
List<BizPerson> selectList(BizPerson entity); List<BizPerson> selectList(BizPerson entity);
/** sponsor 专属: 通过 sys_user.parent_user_id 过滤主账号归属, INNER JOIN 自然排除游离 person */ /** sponsor 专属: 通过 sys_user.parent_user_id 过滤主账号归属, INNER JOIN 自然排除游离 person */
List<BizPerson> selectSponsorList(BizPerson entity); List<BizPerson> selectSponsorList(BizPerson entity);
/** executor 专属: 同 sponsor, SQL 硬编码 unit_type='executor' (前端绕不开) */
List<BizPerson> selectExecutorList(BizPerson entity);
int insert(BizPerson entity); int insert(BizPerson entity);
int updateByPrimaryKey(BizPerson entity); int updateByPrimaryKey(BizPerson entity);
int deleteByPrimaryKey(String personId); int deleteByPrimaryKey(String personId);
@@ -17,6 +17,8 @@ public interface IBizPersonService
List<BizPerson> selectList(BizPerson entity); List<BizPerson> selectList(BizPerson entity);
/** sponsor 专属: 走 BizPersonMapper.selectSponsorList, 用 sys_user.parent_user_id 做归属过滤 */ /** sponsor 专属: 走 BizPersonMapper.selectSponsorList, 用 sys_user.parent_user_id 做归属过滤 */
List<BizPerson> selectSponsorList(BizPerson entity); List<BizPerson> selectSponsorList(BizPerson entity);
/** executor 专属: 同 sponsor, SQL 硬编码 unit_type='executor' (前端绕不开) */
List<BizPerson> selectExecutorList(BizPerson entity);
SysUser insert(BizPerson entity, Long mainUserId); SysUser insert(BizPerson entity, Long mainUserId);
int updateByPrimaryKey(BizPerson entity); int updateByPrimaryKey(BizPerson entity);
int deleteByPrimaryKey(String personId); int deleteByPrimaryKey(String personId);
@@ -35,6 +35,10 @@ public class BizPersonServiceImpl implements IBizPersonService
public List<BizPerson> selectSponsorList(BizPerson entity) public List<BizPerson> selectSponsorList(BizPerson entity)
{ return bizPersonMapper.selectSponsorList(entity); } { return bizPersonMapper.selectSponsorList(entity); }
@Override
public List<BizPerson> selectExecutorList(BizPerson entity)
{ return bizPersonMapper.selectExecutorList(entity); }
/** /**
* sponsor 端新建人员 = 同时创建 sys_user 子账号 (account_type='SUB', parent_user_id=主账号 user_id) * sponsor 端新建人员 = 同时创建 sys_user 子账号 (account_type='SUB', parent_user_id=主账号 user_id)
* 返回新 SysUser 含 username + 明文 password (前端 toast 显示后即丢) * 返回新 SysUser 含 username + 明文 password (前端 toast 显示后即丢)
@@ -161,4 +161,22 @@
</where> </where>
order by p.person_id desc order by p.person_id desc
</select> </select>
<!-- executor 专属: 同 sponsor, SQL 硬编码 unit_type='executor' + parent_user_id=当前主账号 (前端绕不开) -->
<select id="selectExecutorList" resultMap="BizPersonResult" parameterType="BizPerson">
<include refid="selectFieldsWithAccount"/>
<where>
u.del_flag = '0'
and p.unit_type = 'executor'
and u.parent_user_id = #{params.executorOwnerUid}
<if test="name != null and name != ''"> and p.name = #{name}</if>
<if test="phone != null and phone != ''"> and p.phone = #{phone}</if>
<if test="orgId != null"> and p.org_id = #{orgId}</if>
<if test="department != null and department != ''"> and p.department = #{department}</if>
<if test="position != null and position != ''"> and p.position = #{position}</if>
<if test="role != null and role != ''"> and p.role = #{role}</if>
<if test="status != null and status != ''"> and u.status = #{status}</if>
</where>
order by p.person_id desc
</select>
</mapper> </mapper>
+12
View File
@@ -17,3 +17,15 @@ export async function listSponsorPerson(query) {
total: payload?.total || 0 total: payload?.total || 0
} }
} }
/**
* executor 端专属人员列表 (同 sponsor: SQL 硬编码 unit_type='executor', 前端传 unitType 也绕不开)
*/
export async function listExecutorPerson(query) {
const { data } = await request({ url: '/business/person/executorList', method: 'get', params: query })
const payload = data?.data || data
return {
rows: payload?.rows || [],
total: payload?.total || 0
}
}
+6 -5
View File
@@ -95,7 +95,8 @@
<script setup> <script setup>
import { ref, reactive, onMounted } from 'vue' import { ref, reactive, onMounted } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { bizList, bizUpdate } from '@/api/public' import { bizUpdate } from '@/api/public'
import { listExecutorPerson } from '@/api/business/person'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { translatePersonRole } from '@/utils/roleMap' import { translatePersonRole } from '@/utils/roleMap'
@@ -113,10 +114,10 @@ const viewOpen = ref(false)
async function loadList() { async function loadList() {
loading.value = true loading.value = true
try { try {
// request.js 拦截器已归一化为 {code, msg, data: {total, rows}}, 实际数据在 r.data // 走 executor 专属接口, SQL 硬编码 unit_type='executor' + parent_user_id=主账号 (前端绕不开)
const r = await bizList('person', { pageNum: page.pageNum, pageSize: page.pageSize, ...q, unitType: 'executor' }) const r = await listExecutorPerson({ pageNum: page.pageNum, pageSize: page.pageSize, ...q })
list.value = (r.data && r.data.rows) || r.rows || [] list.value = r.rows || []
page.total = (r.data && r.data.total) || r.total || 0 page.total = r.total || 0
} finally { loading.value = false } } finally { loading.value = false }
} }