From b7265cdd6f3e1fbb0d428c27e5b5e29e34d56953 Mon Sep 17 00:00:00 2001 From: zhaoxiaohao <279049017@qq.com> Date: Tue, 17 Nov 2020 17:55:21 +0800 Subject: [PATCH] Merge branch 'dev' --- kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderRecordMapper.xml | 137 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 105 insertions(+), 32 deletions(-) diff --git a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderRecordMapper.xml b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderRecordMapper.xml index 8099d25..029dfb8 100644 --- a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderRecordMapper.xml +++ b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderRecordMapper.xml @@ -84,43 +84,113 @@ <include refid="where"/> order by id desc </select> + <sql id="where_condition"> + <if test="p.id != null and p.id !=''"> + and id = #{p.id} + </if> + <if test="p.proType != null and p.proType !=''"> + and DE.pro_type = #{p.proType} + </if> + <if test="p.enabled != null and p.enabled !=''"> + and DE.enabled = #{p.enabled} + </if> + <if test="p.hospitalName != null and p.hospitalName !=''"> + and PRO.hospital_name like concat ('%',#{p.hospitalName},'%') + </if> + <if test="p.hospitalId != null and p.hospitalId !=''"> + and PRO.hospital_id = #{p.hospitalId} + </if> + <if test="p.departmentId != null and p.departmentId !=''"> + and PRO.department_id = #{p.departmentId} + </if> + <if test="p.proName != null and p.proName !=''"> + and DE.pro_name like concat ('%',#{p.proName},'%') + </if> + <if test="p.createTime != null and p.createTime !='' and p.updateTime != null and p.updateTime !=''"> + and (DE.create_time between #{p.createTime} and #{p.updateTime}) + </if> + <if test="p.startTime!= null and p.startTime !=''"> + and DE.create_time >= #{p.startTime} + </if> + <if test="p.endTime!= null and p.endTime !=''"> + and DE.create_time <= #{p.endTime} + </if> + </sql> <!--sql查询片段--> <sql id="wherelimit"> <where> <!--查询条件自行添加--> DE.is_del=0 - <if test="p.id != null and p.id !=''"> - and id = #{p.id} - </if> - <if test="p.proType != null and p.proType !=''"> - and DE.pro_type = #{p.proType} - </if> - <if test="p.enabled != null and p.enabled !=''"> - and DE.enabled = #{p.enabled} - </if> - <if test="p.hospitalName != null and p.hospitalName !=''"> - and PRO.hospital_name like concat ('%',#{p.hospitalName},'%') - </if> - <if test="p.hospitalId != null and p.hospitalId !=''"> - and PRO.hospital_id = #{p.hospitalId} - </if> - <if test="p.departmentId != null and p.departmentId !=''"> - and PRO.department_id = #{p.departmentId} - </if> - <if test="p.proName != null and p.proName !=''"> - and DE.pro_name like concat ('%',#{p.proName},'%') - </if> - <if test="p.createTime != null and p.createTime !='' and p.updateTime != null and p.updateTime !=''"> - and (DE.create_time between #{p.createTime} and #{p.updateTime}) - </if> - <if test="p.startTime!= null and p.startTime !=''"> - and DE.create_time >= #{p.startTime} - </if> - <if test="p.endTime!= null and p.endTime !=''"> - and DE.create_time <= #{p.endTime} - </if> - <include refid="com.kidgrow.oprationcenter.mapper.SysProductMapper.Role_Organization"></include> + <include refid="where_condition"></include> + <include refid="Role_Organization"></include> </where> + </sql> + <!--定义数据权限的查询--> + <sql id="Role_Organization"> + <if test="p.roleOrg != null and p.roleOrg.size>0"> + <foreach item="item" collection="p.roleOrg" index=""> + <foreach item="itemto" collection="item" index="inx"> + <choose> + <when test="inx == 1"> + <if test="itemto.flag"> + + </if> + <if test="!itemto.flag"> + or ( DE.is_del = 0 and DE.enabled=1) <include refid="where_condition"></include> + </if> + </when> + <when test="inx==2"> + <if test="itemto.flag"> + AND + <foreach item="itemtoto" collection="itemto.object" separator="or" open="(" close=")" + index=""> + DE.create_user_org_code = #{itemtoto.orgCode} + </foreach> + </if> + <if test="!itemto.flag"> + or ( + <foreach item="itemtoto" collection="itemto.object" separator="or" open="(" close=")" + index=""> + DE.create_user_org_code = #{itemtoto.orgCode} + </foreach> + and DE.is_del = 0 and DE.enabled=1 <include refid="where_condition"></include> + ) + </if> + </when> + <when test="inx == 3"> + <if test="itemto.flag"> + AND + DE.create_user_org_code = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (DE.create_user_org_code = #{itemto.object} and DE.is_del = 0 and DE.enabled=1) <include refid="where_condition"></include> + </if> + </when> + <when test="inx == 4"> + <if test="itemto.flag"> + AND + DE.create_user_org_code like '${itemto.object}%' + </if> + <if test="!itemto.flag"> + or (DE.create_user_org_code like '${itemto.object}%' and DE.is_del = 0 and DE.enabled=1) <include refid="where_condition"></include> + </if> + </when> + <when test="inx == 5"> + <if test="itemto.flag"> + AND + DE.create_user_id = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (DE.create_user_id = #{itemto.object} and DE.is_del = 0 and DE.enabled=1) <include refid="where_condition"></include> + </if> + </when> + <otherwise> + AND DE.id is null + </otherwise> + </choose> + </foreach> + </foreach> + </if> </sql> <!--查询产品的消费记录--> <select id="findAllList" resultType="com.kidgrow.oprationcenter.vo.ProductOrderJoinDetail"> @@ -145,7 +215,10 @@ FROM product_order_record DE LEFT JOIN product_order PRO ON DE.order_id = PRO.id - <include refid="wherelimit"/> + <where> + <include refid="where_condition"/> + </where> + order by DE.id desc </select> <select id="groupProductDetail" resultType="com.kidgrow.oprationcenter.vo.GroupProductDetail"> -- Gitblit v1.8.0