| | |
| | | <mapper namespace="com.kidgrow.oprationcenter.mapper.ProductOrderRecordMapper"> |
| | | <!--定义查询列--> |
| | | <sql id="Column_List"> |
| | | * |
| | | DISTINCT * |
| | | </sql> |
| | | |
| | | <!--sql查询片段--> |
| | |
| | | <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"> |
| | |
| | | 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"> |