Commit bb3880d1 by wangchunyang

前台样式调整及测试问题调整

parent 6f19a0ed
...@@ -4,6 +4,7 @@ import com.scpyun.base.core.annotation.Api; ...@@ -4,6 +4,7 @@ import com.scpyun.base.core.annotation.Api;
import com.scpyun.base.core.annotation.ApiOperation; import com.scpyun.base.core.annotation.ApiOperation;
import com.scpyun.base.core.exception.CustomException; import com.scpyun.base.core.exception.CustomException;
import com.scpyun.base.db.service.CommonService; import com.scpyun.base.db.service.CommonService;
import com.scpyun.platform.jilinsscgsdp.utils.DataScopeUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -22,6 +23,8 @@ public class KeyDmStatsServiceImpl { ...@@ -22,6 +23,8 @@ public class KeyDmStatsServiceImpl {
@ApiOperation(value = "使用统计", desc = "统计各部门领用量") @ApiOperation(value = "使用统计", desc = "统计各部门领用量")
public List<Map<String, Object>> selectUsageStats(Map<String, Object> map) { public List<Map<String, Object>> selectUsageStats(Map<String, Object> map) {
if (map == null) map = new HashMap<>(); if (map == null) map = new HashMap<>();
Map<String, Object> user = (Map<String, Object>) map.get("_user");
Map<String, String> pos = DataScopeUtil.getPosition(user);
return commonService.findList(namespace + "selectUsageStats", map); return commonService.findList(namespace + "selectUsageStats", map);
} }
......
...@@ -6,6 +6,7 @@ import com.scpyun.base.core.annotation.ApiOperation; ...@@ -6,6 +6,7 @@ import com.scpyun.base.core.annotation.ApiOperation;
import com.scpyun.base.core.exception.CustomException; import com.scpyun.base.core.exception.CustomException;
import com.scpyun.base.core.utils.UUIDUtil; import com.scpyun.base.core.utils.UUIDUtil;
import com.scpyun.base.db.service.CommonService; import com.scpyun.base.db.service.CommonService;
import com.scpyun.platform.jilinsscgsdp.utils.DataScopeUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -242,4 +243,122 @@ public class KeyDmUserCategoryServiceImpl { ...@@ -242,4 +243,122 @@ public class KeyDmUserCategoryServiceImpl {
if (map == null) map = new HashMap<>(); if (map == null) map = new HashMap<>();
return commonService.findList(namespace + "selectOrgPermission", map); return commonService.findList(namespace + "selectOrgPermission", map);
} }
// ===== 图表分析 =====
@ApiOperation(value = "获取汇总统计数据", desc = "获取请假、申领、入库次数统计")
public Map<String, Object> getSummaryStats() {
Map<String, Object> result = new HashMap<>();
Map<String, Object> map = new HashMap<>();
// 请假次数
Map<String, Object> leaveCount = commonService.getObject(namespace + "getLeaveCount", map);
result.put("leaveCount", leaveCount != null ? leaveCount.get("count") : 0);
// 申领次数
Map<String, Object> borrowCount = commonService.getObject(namespace + "getBorrowCount", map);
result.put("borrowCount", borrowCount != null ? borrowCount.get("count") : 0);
// 入库次数
Map<String, Object> inboundCount = commonService.getObject(namespace + "getInboundCount", map);
result.put("inboundCount", inboundCount != null ? inboundCount.get("count") : 0);
return result;
}
@ApiOperation(value = "获取请假类型统计", desc = "获取各请假类型的占比统计")
public List<Map<String, Object>> getLeaveTypeStats() {
return commonService.findList(namespace + "getLeaveTypeStats", null);
}
@ApiOperation(value = "获取人员请假统计", desc = "获取月度各人员的请假次数统计")
public List<Map<String, Object>> getLeaveUserStats() {
return commonService.findList(namespace + "getLeaveUserStats", null);
}
@ApiOperation(value = "获取用品领用统计", desc = "获取月度各用品的领用量统计")
public List<Map<String, Object>> getMaterialUsageStats() {
return commonService.findList(namespace + "getMaterialUsageStats", null);
}
@ApiOperation(value = "获取库存预警列表", desc = "获取超出或低于阙值的用品信息")
public List<Map<String, Object>> getStockWarningList() {
return commonService.findList(namespace + "getStockWarningList", null);
}
// ===== 部门管理 =====
@ApiOperation(value = "查询部门列表", desc = "分页查询部门")
public Page<Map<String, Object>> selectOrgList(Page<Map<String, Object>> map) {
if (map == null) map = new Page<>();
Map<String, Object> user = (Map<String, Object>) map.getParams().get("_user");
Map<String, String> pos = DataScopeUtil.getPosition(user);
map.getParams().put("area_id", pos.get("area_id"));
return commonService.findPage(namespace + "selectOrgList", map);
}
@ApiOperation(value = "保存部门", desc = "新增或修改部门")
public String saveOrg(Map<String, Object> map) {
if (map == null) {
throw new CustomException("参数不能为空");
}
Object id = map.get("id");
if (id == null || String.valueOf(id).trim().isEmpty()) {
Map<String, Object> user = (Map<String, Object>) map.get("_user");
Map<String, String> pos = DataScopeUtil.getPosition(user);
// 新增
map.put("id", UUIDUtil.getUUID());
map.put("source_org", pos.get("area_id"));
map.put("org_code", map.get("id"));
if (commonService.insert(namespace + "insertOrg", map) != 1) {
throw new CustomException("保存失败");
}
} else {
// 修改
int affected = commonService.update(namespace + "updateOrg", map);
if (affected < 0) throw new CustomException("保存失败");
}
return SUCCESS;
}
@ApiOperation(value = "删除部门", desc = "逻辑删除部门")
public String deleteOrg(Map<String, Object> map) {
if (map == null || map.get("id") == null) {
throw new CustomException("参数不能为空");
}
int affected = commonService.update(namespace + "deleteOrg", map);
if (affected < 0) throw new CustomException("删除失败");
return SUCCESS;
}
@ApiOperation(value = "分配用户到部门", desc = "将用户分配到指定部门")
public String assignUsersToOrg(Map<String, Object> map) {
if (map == null || map.get("org_id") == null) {
throw new CustomException("参数缺失");
}
String orgId = map.get("org_id").toString();
List<String> userIds = (List<String>) map.get("user_ids");
Map<String, Object> user = (Map<String, Object>) map.get("_user");
Map<String, String> pos = DataScopeUtil.getPosition(user);
// 先清除该部门的所有用户分配
Map<String, Object> clearParam = new HashMap<>();
clearParam.put("belong_org_id", orgId);
clearParam.put("area_id", pos.get("area_id"));
clearParam.put("parent_ids", user.get("parent_ids")+","+pos.get("area_id"));
commonService.update(namespace + "clearOrgUsers", clearParam);
// 再分配新用户
if (userIds != null && !userIds.isEmpty()) {
for (String userId : userIds) {
Map<String, Object> assignParam = new HashMap<>();
assignParam.put("user_id", userId);
assignParam.put("belong_org_id", orgId);
// 这里需要根据实际的部门信息设置其他字段
// 暂时只更新 belong_org_id,后续可以扩展
commonService.update(namespace + "assignUserToOrg", assignParam);
}
}
return SUCCESS;
}
} }
...@@ -5,12 +5,14 @@ import com.scpyun.base.core.annotation.Api; ...@@ -5,12 +5,14 @@ import com.scpyun.base.core.annotation.Api;
import com.scpyun.base.core.annotation.ApiOperation; import com.scpyun.base.core.annotation.ApiOperation;
import com.scpyun.base.core.exception.CustomException; import com.scpyun.base.core.exception.CustomException;
import com.scpyun.base.db.service.CommonService; import com.scpyun.base.db.service.CommonService;
import com.scpyun.platform.jilinsscgsdp.utils.DataScopeUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Api("日常人员管理") @Api("日常人员管理")
@Service("keyDmUser") @Service("keyDmUser")
...@@ -24,6 +26,12 @@ public class KeyDmUserServiceImpl { ...@@ -24,6 +26,12 @@ public class KeyDmUserServiceImpl {
@ApiOperation(value = "分页查询日常人员列表", desc = "分页") @ApiOperation(value = "分页查询日常人员列表", desc = "分页")
public Page<Map<String, Object>> selectList(Page<Map<String, Object>> map) { public Page<Map<String, Object>> selectList(Page<Map<String, Object>> map) {
if (map == null) map = new Page<>(); if (map == null) map = new Page<>();
Map<String, Object> user = (Map<String, Object>) map.getParams().get("_user");
if (user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(user);
map.getParams().put("areaId", pos.get("area_id"));
map.getParams().put("parentIds", user.get("parent_ids")+","+pos.get("area_id"));
}
return commonService.findPage(namespace + "selectList", map); return commonService.findPage(namespace + "selectList", map);
} }
...@@ -57,14 +65,26 @@ public class KeyDmUserServiceImpl { ...@@ -57,14 +65,26 @@ public class KeyDmUserServiceImpl {
@ApiOperation(value = "根据机构编码同步用户", desc = "同步本级及下属机构用户") @ApiOperation(value = "根据机构编码同步用户", desc = "同步本级及下属机构用户")
public String syncByOffice(Map<String, Object> map) { public String syncByOffice(Map<String, Object> map) {
// 查询 sys_user 列表(通过 office_code 匹配本级及下属机构) // 查询 sys_user 列表(通过当前机构匹配本级及下属机构)
Map<String, Object> user = (Map<String, Object>) map.get("_user");
if (user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(user);
map.put("areaId", pos.get("area_id"));
map.put("parentIds", user.get("parent_ids")+","+pos.get("area_id"));
}
List<Map<String, Object>> sysUsers = commonService.findList(namespace + "selectSysUserByOfficeCode", map); List<Map<String, Object>> sysUsers = commonService.findList(namespace + "selectSysUserByOfficeCode", map);
List<Map<String, Object>> haveUsers = commonService.findList(namespace + "selectDmUserByOfficeCode", map);
if (sysUsers == null) return SUCCESS; if (sysUsers == null) return SUCCESS;
Map<String, Map<String, Object>> sysUserMap = haveUsers.stream()
.collect(Collectors.toMap(
item -> (String) item.get("id"), // 键提取器:从每个map中取出"id"的值作为新Map的键
item -> item, // 值提取器:每个map本身作为新Map的值
(existing, replacement) -> existing // 合并函数
));
for (Map<String, Object> u : sysUsers) { for (Map<String, Object> u : sysUsers) {
if (u == null) continue; if (u == null) continue;
Map<String, Object> byIdParam = new HashMap<>(); Map<String, Object> exists = sysUserMap.get(String.valueOf(u.get("id")));
byIdParam.put("id", u.get("id"));
Map<String, Object> exists = commonService.getObject(namespace + "getById", byIdParam);
if (exists == null) { if (exists == null) {
// prepare insert map: only copy available fields // prepare insert map: only copy available fields
Map<String, Object> ins = new HashMap<>(); Map<String, Object> ins = new HashMap<>();
...@@ -105,6 +125,12 @@ public class KeyDmUserServiceImpl { ...@@ -105,6 +125,12 @@ public class KeyDmUserServiceImpl {
@ApiOperation(value = "人员选择器列表查询", desc = "根据机构和权限过滤人员") @ApiOperation(value = "人员选择器列表查询", desc = "根据机构和权限过滤人员")
public Page<Map<String, Object>> selectUserSelectorList(Page<Map<String, Object>> map) { public Page<Map<String, Object>> selectUserSelectorList(Page<Map<String, Object>> map) {
if (map == null) map = new Page<>(); if (map == null) map = new Page<>();
Map<String, Object> user = (Map<String, Object>) map.getParams().get("_user");
if (user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(user);
map.getParams().put("areaId", pos.get("area_id"));
map.getParams().put("parentId", user.get("parent_id"));
}
return commonService.findPage(namespace + "selectUserSelectorList", map); return commonService.findPage(namespace + "selectUserSelectorList", map);
} }
...@@ -112,10 +138,12 @@ public class KeyDmUserServiceImpl { ...@@ -112,10 +138,12 @@ public class KeyDmUserServiceImpl {
public Page<Map<String, Object>> selectUserMultiSelectorList(Page<Map<String, Object>> map) { public Page<Map<String, Object>> selectUserMultiSelectorList(Page<Map<String, Object>> map) {
if (map == null) map = new Page<>(); if (map == null) map = new Page<>();
Map<String, Object> user = (Map<String, Object>) map.getParams().get("_user"); Map<String, Object> user = (Map<String, Object>) map.getParams().get("_user");
// if (user != null) { if (user != null) {
// Map<String, String> pos = DataScopeUtil.getPosition(user); Map<String, String> pos = DataScopeUtil.getPosition(user);
// map.getParams().put("orgId", pos.get("area_id")); map.getParams().put("areaId", pos.get("area_id"));
// } map.getParams().put("parentId", user.get("parent_id"));
map.getParams().put("parentIds", user.get("parent_ids")+","+pos.get("area_id"));
}
return commonService.findPage(namespace + "selectUserMultiSelectorList", map); return commonService.findPage(namespace + "selectUserMultiSelectorList", map);
} }
} }
......
...@@ -510,9 +510,214 @@ ...@@ -510,9 +510,214 @@
<if test="permissionType != null and permissionType != ''"> <if test="permissionType != null and permissionType != ''">
AND p.permission_code = #{permissionType} AND p.permission_code = #{permissionType}
</if> </if>
</where> </where>
ORDER BY order_no ASC, create_time DESC ORDER BY order_no ASC, create_time DESC
</select> </select>
<!-- ===== 图表分析 ===== -->
<!-- 获取请假总次数 -->
<select id="getLeaveCount" resultType="map">
SELECT COUNT(*) as count
FROM jl_key_dm_leave_application
WHERE is_used = 1
</select>
<!-- 获取申领总次数 -->
<select id="getBorrowCount" resultType="map">
SELECT COUNT(*) as count
FROM jl_key_dm_borrow_application
WHERE is_used = 1
</select>
<!-- 获取入库总次数 -->
<select id="getInboundCount" resultType="map">
SELECT COUNT(*) as count
FROM jl_key_dm_inbound_record
WHERE is_used = 1
</select>
<!-- 请假类型统计 -->
<select id="getLeaveTypeStats" resultType="map">
SELECT
lt.type_name,
COUNT(la.id) as count
FROM jl_key_dm_leave_type lt
LEFT JOIN jl_key_dm_leave_application la ON la.leave_type_id = lt.id AND la.is_used = 1
WHERE lt.is_used = 1 AND lt.status = 1
GROUP BY lt.id, lt.type_name
ORDER BY count DESC
</select>
<!-- 人员请假统计(月度) -->
<select id="getLeaveUserStats" resultType="map">
SELECT
u.name as user_name,
COUNT(la.id) as leave_count
FROM jl_key_dm_user u
LEFT JOIN jl_key_dm_leave_application la ON la.applicant_id = u.id AND la.is_used = 1
AND DATE_FORMAT(la.create_time, '%Y-%m') = DATE_FORMAT(NOW(), '%Y-%m')
WHERE u.is_used = 1 AND u.is_leave = 0
GROUP BY u.id, u.name
HAVING leave_count > 0
ORDER BY leave_count DESC
LIMIT 20
</select>
<!-- 用品领用统计(月度) -->
<select id="getMaterialUsageStats" resultType="map">
SELECT
m.material_name,
SUM(bd.apply_quantity) as total_quantity
FROM jl_key_dm_material m
LEFT JOIN jl_key_dm_borrow_detail bd ON bd.material_id = m.id
LEFT JOIN jl_key_dm_borrow_application ba ON ba.id = bd.application_id AND ba.is_used = 1
AND DATE_FORMAT(ba.create_time, '%Y-%m') = DATE_FORMAT(NOW(), '%Y-%m')
WHERE m.is_used = 1
GROUP BY m.id, m.material_name
HAVING total_quantity &gt; 0
ORDER BY total_quantity DESC
LIMIT 20
</select>
<!-- 库存预警列表 -->
<select id="getStockWarningList" resultType="map">
SELECT
m.material_name,
i.available_quantity,
m.min_stock,
m.max_stock,
CASE
WHEN i.available_quantity &lt; m.min_stock THEN 'low'
WHEN i.available_quantity &gt; m.max_stock THEN 'high'
END as status
FROM jl_key_dm_material m
LEFT JOIN jl_key_dm_inventory i ON i.material_id = m.id
WHERE m.is_used = 1
AND (i.available_quantity &lt; m.min_stock OR i.available_quantity &gt; m.max_stock)
ORDER BY
CASE
WHEN i.available_quantity &lt; m.min_stock THEN 1
WHEN i.available_quantity &gt; m.max_stock THEN 2
END,
ABS(i.available_quantity - (m.min_stock + m.max_stock) / 2) DESC
</select>
<!-- ===== 部门管理 ===== -->
<select id="selectOrgList" parameterType="page" resultType="map">
<!-- SELECT-->
<!-- id,-->
<!-- source_org,-->
<!-- org_code,-->
<!-- org_name,-->
<!-- remark,-->
<!-- is_used,-->
<!-- create_by,-->
<!-- create_time,-->
<!-- update_by,-->
<!-- update_time,-->
<!-- order_no-->
<!-- FROM jl_key_dm_org-->
<!-- <where>-->
<!-- AND is_used = 1-->
<!-- <if test="params.org_name != null and params.org_name != ''">-->
<!-- AND org_name LIKE CONCAT('%', #{params.org_name}, '%')-->
<!-- </if>-->
<!-- <if test="params.org_code != null and params.org_code != ''">-->
<!-- AND org_code LIKE CONCAT('%', #{params.org_code}, '%')-->
<!-- </if>-->
<!-- </where>-->
<!-- ORDER BY order_no ASC, create_time DESC-->
SELECT
org.id,
org.org_name,
org.source_org,
org.org_code,
org.order_no,
GROUP_CONCAT(CONCAT(u.name) SEPARATOR ',') AS user_names,
JSON_ARRAYAGG(
JSON_OBJECT(
'user_id', u.id,
'user_name', u.name
)
) AS users
FROM jl_key_dm_org org
LEFT JOIN jl_key_dm_user u ON u.belong_org_id = org.id AND u.is_used = 1
<where>
AND org.is_used = 1 AND source_org = #{params.area_id}
<if test="params.org_name != null and params.org_name != ''">
AND org_name LIKE CONCAT('%', #{params.org_name}, '%')
</if>
</where>
GROUP BY org.id, org.org_name,org.source_org,org.org_code,org.order_no
ORDER BY org.order_no
</select>
<insert id="insertOrg" parameterType="map">
INSERT INTO jl_key_dm_org(
id,
source_org,
org_code,
org_name,
remark,
is_used,
create_by,
create_time,
order_no
) VALUES (
#{id},
#{source_org},
#{org_code},
#{org_name},
#{remark},
1,
#{_user.id},
NOW(),
#{order_no}
)
</insert>
<update id="updateOrg" parameterType="map">
UPDATE jl_key_dm_org
SET
org_name = #{org_name},
remark = #{remark},
order_no = #{order_no},
update_by = #{_user.id},
update_time = NOW()
WHERE id = #{id}
</update>
<update id="deleteOrg" parameterType="map">
UPDATE jl_key_dm_org
SET
is_used = 0,
update_by = #{_user.id},
update_time = NOW()
WHERE id = #{id}
</update>
<!-- 清除部门用户分配 -->
<update id="clearOrgUsers" parameterType="map">
UPDATE jl_key_dm_user
SET
belong_org_id = NULL,
belong_org_code = NULL,
belong_org_name = NULL,
update_by = #{_user.id},
update_time = NOW()
WHERE belong_org_id = #{belong_org_id}
AND office_id in (select id from sys_office where id = #{area_id} or parent_ids like #{parent_ids})
</update>
<!-- 分配用户到部门 -->
<update id="assignUserToOrg" parameterType="map">
UPDATE jl_key_dm_user
SET
belong_org_id = #{belong_org_id},
belong_org_code = (SELECT org_code FROM jl_key_dm_org WHERE id = #{belong_org_id}),
belong_org_name = (SELECT org_name FROM jl_key_dm_org WHERE id = #{belong_org_id}),
update_by = #{_user.id},
update_time = NOW()
WHERE id = #{user_id}
</update>
</mapper> </mapper>
...@@ -30,16 +30,12 @@ ...@@ -30,16 +30,12 @@
LEFT JOIN sys_office o ON o.id = u.office_id LEFT JOIN sys_office o ON o.id = u.office_id
<where> <where>
AND u.is_used = 1 AND u.is_used = 1
AND (o.parent_ids LIKE CONCAT(#{params.parentIds}, '%') OR u.office_id = #{params._user.company_id})
<if test="params.name != null and params.name != ''"> <if test="params.name != null and params.name != ''">
AND u.name LIKE CONCAT('%', #{params.name}, '%') AND u.name LIKE CONCAT('%', #{params.name}, '%')
</if> </if>
<if test="params._user.company_id != null and params._user.company_id != ''">
AND o.parent_ids LIKE CONCAT('%', #{params._user.company_id}, '%')
</if>
</where> </where>
ORDER BY o.grade,o.sort,u.order_no ASC, u.create_time DESC
ORDER BY u.order_no ASC, u.create_time DESC
</select> </select>
<select id="selectUserLeaderById" parameterType="page" resultType="map"> <select id="selectUserLeaderById" parameterType="page" resultType="map">
...@@ -120,7 +116,7 @@ ...@@ -120,7 +116,7 @@
FROM sys_user su FROM sys_user su
WHERE su.office_id IN ( WHERE su.office_id IN (
SELECT so.id FROM sys_office so SELECT so.id FROM sys_office so
WHERE so.parent_ids LIKE CONCAT('%', #{_user.company_id}, '%') OR so.code = #{_user.company_id} WHERE so.parent_ids LIKE CONCAT(#{parentIds}, '%') OR so.id = #{_user.company_id}
) )
AND (su.del_flag IS NULL OR su.del_flag = '0') AND (su.del_flag IS NULL OR su.del_flag = '0')
</select> </select>
...@@ -186,35 +182,21 @@ ...@@ -186,35 +182,21 @@
u.email, u.email,
u.phone, u.phone,
u.mobile, u.mobile,
o.name AS office_name, o.name AS office_name
GROUP_CONCAT(DISTINCT c.catgory_name SEPARATOR ', ') AS category_names
FROM jl_key_dm_user u FROM jl_key_dm_user u
LEFT JOIN sys_office o ON o.id = u.office_id LEFT JOIN sys_office o ON o.id = u.office_id
LEFT JOIN jl_key_dm_user_catgory c ON FIND_IN_SET(c.id, u.rc_role_id) > 0
<where> <where>
AND u.is_used = 1 AND u.is_used = 1 AND u.is_leave = 0 AND o.del_flag = 0
AND u.is_leave = 0 AND (o.id = #{params.parentId} or o.area_id = #{params.areaId})
<if test="params.office_code != null and params.office_code != ''">
AND u.office_id IN (
SELECT so.id FROM sys_office so
WHERE so.parent_ids LIKE CONCAT('%', #{params.office_code}, '%')
OR so.code = #{params.office_code}
)
</if>
<if test="params.permission != null and params.permission != ''"> <if test="params.permission != null and params.permission != ''">
AND EXISTS ( AND u.id in (select id from jl_key_dm_permission_user where permission_code = #{params.permission})
SELECT 1 FROM jl_key_dm_user_qx qx
WHERE qx.catgory_id = c.id
AND qx.permission_mark = #{params.permission}
AND qx.is_used = 1
)
</if> </if>
<if test="params.name != null and params.name != ''"> <if test="params.name != null and params.name != ''">
AND u.name LIKE CONCAT('%', #{params.name}, '%') AND u.name LIKE CONCAT('%', #{params.name}, '%')
</if> </if>
</where> </where>
GROUP BY u.id, u.name, u.gh, u.email, u.phone, u.mobile, o.name GROUP BY u.id, u.name, u.gh, u.email, u.phone, u.mobile, o.name
ORDER BY u.name ASC ORDER BY o.grade, o.sort, u.name ASC
</select> </select>
<!-- 人员多选器列表查询(所有在职人员) --> <!-- 人员多选器列表查询(所有在职人员) -->
...@@ -233,16 +215,18 @@ ...@@ -233,16 +215,18 @@
<where> <where>
AND u.is_used = 1 AND u.is_used = 1
AND IFNULL(u.is_leave, 0) = 0 AND IFNULL(u.is_leave, 0) = 0
<if test="params.round == '1'.toString()">
AND (u.office_id = #{params.parentId} or o.area_id = #{params.areaId} or o.parent_ids LIKE CONCAT(#{params.parentIds}, '%') )
</if>
<if test="params.round == '2'.toString()">
AND o.area_id = #{params.areaId}
</if>
<if test="params.name != null and params.name != ''"> <if test="params.name != null and params.name != ''">
AND u.name LIKE CONCAT('%', #{params.name}, '%') AND u.name LIKE CONCAT('%', #{params.name}, '%')
</if> </if>
<if test="params.orgId != null and params.orgId != ''">
AND (o.office_id = #{params.orgId} or o.parent_id = #{params.orgId})
</if>
<if test="params.pcode != null and params.pcode != ''"> <if test="params.pcode != null and params.pcode != ''">
AND NOT EXISTS (SELECT id from jl_key_dm_permission_user where u.id=user_id is null and permission_code=#{params.params.pcode}) AND NOT EXISTS (SELECT id from jl_key_dm_permission_user where u.id=user_id is null and permission_code=#{params.pcode})
</if> </if>
</where> </where>
ORDER BY o.grade, o.sort ORDER BY o.grade, o.sort
</select> </select>
...@@ -254,6 +238,14 @@ ...@@ -254,6 +238,14 @@
from jl_key_dm_user from jl_key_dm_user
where is_used = 1 where is_used = 1
</select> </select>
</mapper> <!-- 获取日常人员 -->
<select id="selectDmUserByOfficeCode" parameterType="map" resultType="map">
SELECT du.*
FROM jl_key_dm_user du
WHERE du.office_id IN (
SELECT so.id FROM sys_office so
WHERE so.parent_ids LIKE CONCAT(#{parentIds}, '%') OR so.id = #{_user.company_id}
)
</select></mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论