Commit ac8e4ea7 by wangchunyang

测试问题调整,合并查询文件

parent 436064e7
...@@ -31,7 +31,7 @@ public class KeyDmBorrowServiceImpl { ...@@ -31,7 +31,7 @@ public class KeyDmBorrowServiceImpl {
private static final String SUCCESS = "success"; private static final String SUCCESS = "success";
private final String namespace = "com.scpyun.platform.standard.jilinsscgsdp.keyDmBorrow."; private final String namespace = "com.scpyun.platform.standard.jilinsscgsdp.keyDmBorrow.";
private final String detailNamespace = "com.scpyun.platform.standard.jilinsscgsdp.keyDmBorrowDetail."; private final String detailNamespace = "com.scpyun.platform.standard.jilinsscgsdp.keyDmBorrow.";
private final String materialNamespace = "com.scpyun.platform.standard.jilinsscgsdp.keyDmMaterialLog."; private final String materialNamespace = "com.scpyun.platform.standard.jilinsscgsdp.keyDmMaterialLog.";
private final String userNamespace = "com.scpyun.platform.standard.jilinsscgsdp.keyDmUser."; private final String userNamespace = "com.scpyun.platform.standard.jilinsscgsdp.keyDmUser.";
private Map<String, String> userMap; private Map<String, String> userMap;
...@@ -309,7 +309,7 @@ public class KeyDmBorrowServiceImpl { ...@@ -309,7 +309,7 @@ public class KeyDmBorrowServiceImpl {
if (user != null) { if (user != null) {
Map<String, String> pos = DataScopeUtil.getPosition(user); Map<String, String> pos = DataScopeUtil.getPosition(user);
areaId = pos.get("area_id"); areaId = pos.get("area_id");
user.put("areaId", areaId); map.put("areaId", areaId);
} }
Map<String, Object> ret = new HashMap<>(); Map<String, Object> ret = new HashMap<>();
Map<String, Object> app = commonService.getObject(namespace + "getById", map); Map<String, Object> app = commonService.getObject(namespace + "getById", map);
......
...@@ -24,6 +24,8 @@ import javax.annotation.PostConstruct; ...@@ -24,6 +24,8 @@ import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
......
...@@ -251,6 +251,11 @@ public class KeyDmUserCategoryServiceImpl { ...@@ -251,6 +251,11 @@ public class KeyDmUserCategoryServiceImpl {
public List<Map<String, Object>> selectOrgPermission(Map<String, Object> map) { public List<Map<String, Object>> selectOrgPermission(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, 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("parentId", user.get("parent_id"));
}
String leader = commonService.getObject(namespace + "findLeader", user.get("id")); String leader = commonService.getObject(namespace + "findLeader", user.get("id"));
List<Map<String, Object>> userList = commonService.findList(namespace + "selectOrgPermission", map); List<Map<String, Object>> userList = commonService.findList(namespace + "selectOrgPermission", map);
for (Map<String, Object> map1 : userList) { for (Map<String, Object> map1 : userList) {
......
...@@ -250,6 +250,31 @@ ...@@ -250,6 +250,31 @@
<select id="selectLogsByApplicationId" parameterType="map"> <select id="selectLogsByApplicationId" parameterType="map">
</select> </select>
<!-- detail-->
<insert id="insertDetail" parameterType="map">
INSERT INTO jl_key_dm_borrow_application_detail(
id,application_id,material_id,material_code,material_name,apply_quantity,unit,issue_remark,returned_quantity,damaged_quantity,is_used,create_by,create_time
) VALUES (
UUID(),#{application_id},#{material_id},#{material_code},#{material_name},#{apply_quantity},#{unit},#{issue_remark},COALESCE(#{returned_quantity},0),COALESCE(#{damaged_quantity},0),1,#{_user.id},NOW()
)
</insert>
<select id="selectDetailsByApplicationId" parameterType="map" resultType="map">
SELECT bd.*,m.category_id,(COALESCE(i.total_quantity,0) - COALESCE(i.borrowed_quantity) - COALESCE(i.damaged_quantity)) as available_quantity
FROM jl_key_dm_borrow_application_detail as bd
left join jl_key_dm_material as m
on m.id = bd.material_id
left join jl_key_dm_inventory as i
on bd.material_id = i.material_id and i.apply_dep_code = #{areaId}
<where>
bd.application_id = #{id} AND bd.is_used = 1
<!-- <if test="areaId != null">-->
<!-- and i.apply_dep_code = #{areaId}-->
<!-- </if>-->
</where>
ORDER BY bd.create_time ASC
</select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//oos.juyouhx.com//DTD Mapper 3.0//EN" "http://oss.juyouhx.com/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.scpyun.platform.standard.jilinsscgsdp.keyDmBorrowDetail" name="领用申请明细">
<insert id="insertDetail" parameterType="map">
INSERT INTO jl_key_dm_borrow_application_detail(
id,application_id,material_id,material_code,material_name,apply_quantity,unit,issue_remark,returned_quantity,damaged_quantity,is_used,create_by,create_time
) VALUES (
UUID(),#{application_id},#{material_id},#{material_code},#{material_name},#{apply_quantity},#{unit},#{issue_remark},COALESCE(#{returned_quantity},0),COALESCE(#{damaged_quantity},0),1,#{_user.id},NOW()
)
</insert>
<select id="selectDetailsByApplicationId" parameterType="map" resultType="map">
SELECT bd.*,m.category_id,(COALESCE(i.total_quantity,0) - COALESCE(i.borrowed_quantity) - COALESCE(i.damaged_quantity)) as available_quantity
FROM jl_key_dm_borrow_application_detail as bd
left join jl_key_dm_material as m
on m.id = bd.material_id
left join jl_key_dm_inventory as i
on bd.material_id = i.material_id
<where>
bd.application_id = #{id} AND bd.is_used = 1
<if test="_user.areaId != null">
and i.apply_dep_code = #{_user.areaId}
</if>
</where>
ORDER BY bd.create_time ASC
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//oos.juyouhx.com//DTD Mapper 3.0//EN" "http://oss.juyouhx.com/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.scpyun.platform.standard.jilinsscgsdp.keyDmInboundDetail" name="入库明细">
<insert id="insertDetail" parameterType="map">
INSERT INTO jl_key_dm_inbound_detail(
id,inbound_id,material_id,inbound_type,inbound_quantity,unit_price,total_amount,production_date,expiry_date,is_used,create_by,create_time
) VALUES (
#{id},#{inbound_id},#{material_id},#{inbound_type},#{inbound_quantity},#{unit_price},#{total_amount},#{production_date},#{expiry_date},1,#{_user.id},NOW()
)
</insert>
<select id="selectDetailsByInboundId" parameterType="map" resultType="map">
SELECT i.*,
m.material_code, m.material_name, m.category_id
FROM jl_key_dm_inbound_detail as i
left join jl_key_dm_material as m
on i.material_id = m.id
WHERE i.inbound_id = #{id} AND i.is_used = 1 ORDER BY i.create_time ASC
</select>
<!-- <delete id="deleteDetailsByInboundId" parameterType="map">-->
<!-- DELETE FROM jl_key_dm_inbound_detail WHERE inbound_id = #{id}-->
<!-- </delete>-->
<update id="deleteDetailsByInboundId" parameterType="map">
UPDATE jl_key_dm_inbound_detail SET is_used = 0, update_by = #{_user.id}, update_time = NOW() WHERE inbound_id = #{id}
</update>
</mapper>
...@@ -349,7 +349,7 @@ ...@@ -349,7 +349,7 @@
(COALESCE(i.total_quantity,0) - COALESCE(i.borrowed_quantity) - COALESCE(i.damaged_quantity)) as available_quantity (COALESCE(i.total_quantity,0) - COALESCE(i.borrowed_quantity) - COALESCE(i.damaged_quantity)) as available_quantity
FROM jl_key_dm_material m FROM jl_key_dm_material m
LEFT JOIN jl_key_dm_material_category c ON c.id = m.category_id LEFT JOIN jl_key_dm_material_category c ON c.id = m.category_id
left join jl_key_dm_inventory as i on i.material_id = m.id left join jl_key_dm_inventory as i on i.material_id = m.id AND i.apply_dep_code = #{params.areaId}
<where> <where>
AND m.is_used = 1 AND m.is_used = 1
<if test="params.material_name != null and params.material_name != ''"> <if test="params.material_name != null and params.material_name != ''">
...@@ -361,9 +361,9 @@ ...@@ -361,9 +361,9 @@
<if test="params.category_id != null and params.category_id != ''"> <if test="params.category_id != null and params.category_id != ''">
AND m.category_id = #{params.category_id} AND m.category_id = #{params.category_id}
</if> </if>
<if test="params.areaId != null and params.areaId != ''"> <!-- <if test="params.areaId != null and params.areaId != ''">-->
AND i.apply_dep_code = #{params.areaId} <!-- AND i.apply_dep_code = #{params.areaId}-->
</if> <!-- </if>-->
</where> </where>
ORDER BY c.order_no,m.order_no ASC, m.create_time DESC ORDER BY c.order_no,m.order_no ASC, m.create_time DESC
</select> </select>
...@@ -504,11 +504,13 @@ ...@@ -504,11 +504,13 @@
u.order_no u.order_no
FROM jl_key_dm_permission_user p FROM jl_key_dm_permission_user p
left join jl_key_dm_user u on p.user_id = u.id left join jl_key_dm_user u on p.user_id = u.id
left join sys_office so on u.office_id = so.id
<where> <where>
AND is_used = 1 AND is_used = 1
<if test="_user.company_id != null"> AND so.area_id = #{areaId}
AND u.office_id = #{_user.company_id} <!-- <if test="_user.company_id != null">-->
</if> <!-- AND u.office_id = #{_user.company_id}-->
<!-- </if>-->
<if test="_user.id != null and _user.id != ''"> <if test="_user.id != null and _user.id != ''">
AND u.id != #{_user.id} AND u.id != #{_user.id}
</if> </if>
...@@ -865,7 +867,7 @@ ...@@ -865,7 +867,7 @@
</if> </if>
</where> </where>
) t LEFT JOIN jl_key_dm_user u on t.uid=u.id LEFT JOIN sys_office o on u.office_id=o.id ) t LEFT JOIN jl_key_dm_user u on t.uid=u.id LEFT JOIN sys_office o on u.office_id=o.id
<!-- WHERE o.area_id = #{areaId}--> WHERE o.area_id = #{areaId}
GROUP BY t.uid, t.uname, o.name, o.grade, o.sort GROUP BY t.uid, t.uname, o.name, o.grade, o.sort
ORDER BY o.grade, o.sort, leave_applications DESC, borrow_applications DESC ORDER BY o.grade, o.sort, leave_applications DESC, borrow_applications DESC
</select> </select>
......
...@@ -189,7 +189,8 @@ ...@@ -189,7 +189,8 @@
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_leave = 0 AND o.del_flag = 0 AND u.is_used = 1 AND u.is_leave = 0 AND o.del_flag = 0
AND (o.id = #{params.parentId} or o.area_id = #{params.areaId}) AND o.area_id = #{params.areaId}
<!-- AND (o.id = #{params.parentId} or o.area_id = #{params.areaId})-->
<if test="params.permission != null and params.permission != ''"> <if test="params.permission != null and params.permission != ''">
AND u.id in (select id from jl_key_dm_permission_user where permission_code = #{params.permission}) AND u.id in (select id from jl_key_dm_permission_user where permission_code = #{params.permission})
</if> </if>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论