Commit c5829391 by yubin

Merge remote-tracking branch 'origin/master'

parents 4830f5a8 eb21f58e
...@@ -38,6 +38,11 @@ public class KeyDmUserCategoryServiceImpl { ...@@ -38,6 +38,11 @@ public class KeyDmUserCategoryServiceImpl {
return commonService.findList(namespace + "selectPermissionConfigList", null); return commonService.findList(namespace + "selectPermissionConfigList", null);
} }
@ApiOperation(value = "获取人员权限配置列表", desc = "从字典获取权限并关联用户")
public List<Map<String, Object>> selectUserDmPermissionList(Map<String, Object> map) {
return commonService.findList(namespace + "selectUserDmPermissionList", map);
}
@ApiOperation(value = "保存权限用户配置", desc = "保存权限对应的用户配置") @ApiOperation(value = "保存权限用户配置", desc = "保存权限对应的用户配置")
public String savePermissionUsers(Map<String, Object> map) { public String savePermissionUsers(Map<String, Object> map) {
if (map == null || map.get("permission_code") == null) { if (map == null || map.get("permission_code") == null) {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<if test="params.params.application_no != null and params.params.application_no != ''"> <if test="params.params.application_no != null and params.params.application_no != ''">
AND application_no LIKE CONCAT('%', #{params.params.application_no}, '%') AND application_no LIKE CONCAT('%', #{params.params.application_no}, '%')
</if> </if>
<if test="params.params.approval_status != null and params.params.approval_status != ''"> <if test="params.params.approval_status != null">
AND approval_status = #{params.params.approval_status} AND approval_status = #{params.params.approval_status}
</if> </if>
</where> </where>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</update> </update>
<update id="approve" parameterType="map"> <update id="approve" parameterType="map">
UPDATE jl_key_dm_borrow_application SET approval_status = 9, approval_time = NOW(), issue_status = 1, update_by = #{_user.id}, update_time = NOW() WHERE id = #{id} UPDATE jl_key_dm_borrow_application SET approval_status = 9, approval_time = NOW(), issue_time = NOW(), issue_status = 1, update_by = #{_user.id}, update_time = NOW() WHERE id = #{id}
</update> </update>
<update id="reject" parameterType="map"> <update id="reject" parameterType="map">
...@@ -94,16 +94,37 @@ ...@@ -94,16 +94,37 @@
FROM jl_key_dm_borrow_application WHERE id = #{id} FROM jl_key_dm_borrow_application WHERE id = #{id}
</insert> </insert>
<select id="selectInventoryByMaterialId" parameterType="map" resultType="map">
select i.*,m.can_borrow
from jl_key_dm_inventory as i
left join jl_key_dm_material as m
on m.id = i.material_id
where material_id = #{material_id}
</select>
<!-- 更新库存:根据申请明细扣减可用库存(mapper 内部实现以事务执行) -->
<update id="updateInventoryTotalQuantity" parameterType="map">
<!-- 简化:调用存储过程或在 mapper 中实现逐条更新 -->
<!-- 实际实现依赖于业务,留给 mapper/服务调用具体 SQL -->
update jl_key_dm_inventory
set total_quantity = total_quantity - #{apply_quantity}
where material_id = #{material_id}
</update>
<!-- 更新库存:根据申请明细扣减可用库存(mapper 内部实现以事务执行) --> <!-- 更新库存:根据申请明细扣减可用库存(mapper 内部实现以事务执行) -->
<update id="updateInventoryByApplication" parameterType="map"> <update id="updateInventoryBorrowedQuantity" parameterType="map">
<!-- 简化:调用存储过程或在 mapper 中实现逐条更新 --> <!-- 简化:调用存储过程或在 mapper 中实现逐条更新 -->
<!-- 实际实现依赖于业务,留给 mapper/服务调用具体 SQL --> <!-- 实际实现依赖于业务,留给 mapper/服务调用具体 SQL -->
update jl_key_dm_inventory set update jl_key_dm_inventory
set borrowed_quantity = borrowed_quantity + #{apply_quantity}
where material_id = #{material_id}
</update> </update>
<!-- 插入日志 --> <!-- 插入日志 -->
<insert id="insertMaterialLogByApplication" parameterType="map"> <insert id="insertMaterialLogByApplication" parameterType="map">
<!-- 简化:实现者可在业务层调用单条插入,此处为占位 --> <!-- 简化:实现者可在业务层调用单条插入,此处为占位 -->
insert into jl_key_dm_material_log()
</insert> </insert>
<select id="selectLogsByApplicationId" parameterType="map"> <select id="selectLogsByApplicationId" parameterType="map">
......
...@@ -11,7 +11,11 @@ ...@@ -11,7 +11,11 @@
</insert> </insert>
<select id="selectDetailsByApplicationId" parameterType="map" resultType="map"> <select id="selectDetailsByApplicationId" parameterType="map" resultType="map">
SELECT * FROM jl_key_dm_borrow_application_detail WHERE application_id = #{id} AND is_used = 1 ORDER BY create_time ASC SELECT bd.*,m.category_id
FROM jl_key_dm_borrow_application_detail as bd
left join jl_key_dm_material as m
on m.id = bd.material_id
WHERE bd.application_id = #{id} AND bd.is_used = 1 ORDER BY bd.create_time ASC
</select> </select>
</mapper> </mapper>
......
...@@ -111,7 +111,11 @@ ...@@ -111,7 +111,11 @@
</insert> </insert>
<select id="selectLogsByInboundId" parameterType="map" resultType="map"> <select id="selectLogsByInboundId" parameterType="map" resultType="map">
SELECT * FROM jl_key_dm_material_log WHERE relation_id = #{id} AND is_used = 1 ORDER BY create_time ASC SELECT ml.*,m.material_name
FROM jl_key_dm_material_log as ml
left join jl_key_dm_material as m
on m.id = ml.material_id
WHERE ml.relation_id = #{id} AND ml.is_used = 1 ORDER BY ml.create_time ASC
</select> </select>
</mapper> </mapper>
......
...@@ -8,13 +8,18 @@ ...@@ -8,13 +8,18 @@
) VALUES ) VALUES
<foreach collection="details" item="item" separator=","> <foreach collection="details" item="item" separator=",">
( (
UUID(),#{item.category_id},#{item.id},1,#{item.inbound_id},#{item.id},#{item.inbound_quantity},#{item.unit_price},#{item.total_amount},1,#{_user.id},NOW() UUID(),#{item.category_id},#{item.material_id},#{op_type},#{id},#{item.material_id},#{item.apply_quantity},#{item.unit_price},#{item.total_amount},1,#{create_by},NOW()
) )
</foreach> </foreach>
</insert> </insert>
<select id="selectLogsByApplicationId" parameterType="map" resultType="map"> <select id="selectLogsByApplicationId" parameterType="map" resultType="map">
SELECT * FROM jl_key_dm_material_log WHERE relation_id = #{id} AND is_used = 1 ORDER BY create_time ASC SELECT ml.*,m.material_name
FROM jl_key_dm_material_log as ml
left join jl_key_dm_material as m
on ml.material_id = m.id
WHERE relation_id = #{id}
AND ml.is_used = 1 ORDER BY ml.create_time ASC
</select> </select>
</mapper> </mapper>
......
...@@ -78,17 +78,19 @@ ...@@ -78,17 +78,19 @@
SELECT l.user_id AS uid, l.user_name AS uname, 1 AS leave_app, 0 AS leave_approve, 0 AS borrow_app, 0 AS inbound_cnt, COALESCE(l.duration,0) AS leave_duration SELECT l.user_id AS uid, l.user_name AS uname, 1 AS leave_app, 0 AS leave_approve, 0 AS borrow_app, 0 AS inbound_cnt, COALESCE(l.duration,0) AS leave_duration
FROM jl_key_dm_leave_application l FROM jl_key_dm_leave_application l
<where> <where>
AND l.is_used = 1 AND l.STATUS != 0
<if test="start != null and start != ''"> <if test="start != null and start != ''">
AND l.create_time &gt; #{start} AND l.start_time &gt; #{start}
</if> </if>
<if test="end != null and end != ''"> <if test="end != null and end != ''">
AND l.create_time &lt; #{end} AND l.start_time &lt; #{end}
</if> </if>
</where> </where>
UNION ALL UNION ALL
SELECT r.approver_id AS uid, r.approver_name AS uname, 0, CASE WHEN r.approver_result = 1 THEN 1 ELSE 0 END, 0, 0, 0 SELECT r.approver_id AS uid, r.approver_name AS uname, 0, CASE WHEN r.approver_result = 1 THEN 1 ELSE 0 END, 0, 0, 0
FROM jl_key_dm_leave_approval_record r FROM jl_key_dm_leave_approval_record r
<where> <where>
AND r.is_used = 1 AND r.STATUS = 2
<if test="start != null and start != ''"> <if test="start != null and start != ''">
AND r.approver_time &gt; #{start} AND r.approver_time &gt; #{start}
</if> </if>
...@@ -100,22 +102,24 @@ ...@@ -100,22 +102,24 @@
SELECT b.applicant_id AS uid, b.applicant_name AS uname, 0, 0, 1, 0, 0 SELECT b.applicant_id AS uid, b.applicant_name AS uname, 0, 0, 1, 0, 0
FROM jl_key_dm_borrow_application b FROM jl_key_dm_borrow_application b
<where> <where>
AND b.is_used = 1 AND b.approval_status != 0
<if test="start != null and start != ''"> <if test="start != null and start != ''">
AND b.create_time &gt; #{start} AND b.submit_time &gt; #{start}
</if> </if>
<if test="end != null and end != ''"> <if test="end != null and end != ''">
AND b.create_time &lt; #{end} AND b.submit_time &lt; #{end}
</if> </if>
</where> </where>
UNION ALL UNION ALL
SELECT o.receiver_id AS uid, o.receiver_name AS uname, 0, 0, 0, 1, 0 SELECT ir.create_by AS uid, du.`name` AS uname, 0, 0, 0, 1, 0
FROM jl_key_dm_outbound_record o FROM jl_key_dm_inbound_record ir LEFT JOIN jl_key_dm_user du on ir.create_by = du.id
<where> <where>
AND ir.is_used = 1
<if test="start != null and start != ''"> <if test="start != null and start != ''">
AND o.create_time &gt; #{start} AND ir.create_time &gt; #{start}
</if> </if>
<if test="end != null and end != ''"> <if test="end != null and end != ''">
AND o.create_time &lt; #{end} AND ir.create_time &lt; #{end}
</if> </if>
</where> </where>
) t ) t
...@@ -127,9 +131,9 @@ ...@@ -127,9 +131,9 @@
<select id="selectWorkloadDetails" parameterType="map" resultType="map"> <select id="selectWorkloadDetails" parameterType="map" resultType="map">
<choose> <choose>
<when test="type == 'leave'"> <when test="type == 'leave'">
SELECT id, user_id, user_name, start_time, end_time, duration, reason FROM jl_key_dm_leave_application SELECT id, user_id, user_name, start_time, end_time, duration, reason, `status` FROM jl_key_dm_leave_application
<where> <where>
AND user_id = #{user_id} AND user_id = #{user_id} AND STATUS != 0
<if test="start != null and start != ''"> <if test="start != null and start != ''">
AND create_time &gt; #{start} AND create_time &gt; #{start}
</if> </if>
...@@ -140,19 +144,19 @@ ...@@ -140,19 +144,19 @@
ORDER BY create_time DESC ORDER BY create_time DESC
</when> </when>
<when test="type == 'inventory'"> <when test="type == 'inventory'">
SELECT b.application_no, b.applicant_id, b.applicant_name, d.material_name, d.apply_quantity SELECT b.application_no, b.applicant_id, b.applicant_name, d.material_name, b.approval_status, d.apply_quantity, d.returned_quantity,b.submit_time
FROM jl_key_dm_borrow_application_detail d FROM jl_key_dm_borrow_application_detail d
LEFT JOIN jl_key_dm_borrow_application b ON b.id = d.application_id LEFT JOIN jl_key_dm_borrow_application b ON b.id = d.application_id
<where> <where>
b.applicant_id = #{user_id} AND b.is_used = 1 AND b.approval_status != 0 AND b.applicant_id = #{user_id}
<if test="start != null and start != ''"> <if test="start != null and start != ''">
AND b.create_time &gt; #{start} AND b.submit_time &gt; #{start}
</if> </if>
<if test="end != null and end != ''"> <if test="end != null and end != ''">
AND b.create_time &lt; #{end} AND b.submit_time &lt; #{end}
</if> </if>
</where> </where>
ORDER BY b.create_time DESC ORDER BY b.submit_time DESC
</when> </when>
<otherwise> <otherwise>
SELECT 1 AS dummy SELECT 1 AS dummy
......
...@@ -48,6 +48,14 @@ ...@@ -48,6 +48,14 @@
) )
</insert> </insert>
<!-- 获取人员日常管理权限列表 -->
<select id="selectUserDmPermissionList" resultType="map">
SELECT
pu.permission_code as code
FROM jl_key_dm_permission_user pu
WHERE pu.user_id = #{_user.id}
</select>
<!-- ===== 请假类型管理 ===== --> <!-- ===== 请假类型管理 ===== -->
<select id="selectLeaveTypeList" parameterType="page" resultType="map"> <select id="selectLeaveTypeList" parameterType="page" resultType="map">
SELECT SELECT
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论