From 1e228c1191996a8e704cf36dc8042b1c6ca81ef1 Mon Sep 17 00:00:00 2001 From: houruijun <411269194@kidgrow.com> Date: Wed, 04 Nov 2020 10:59:05 +0800 Subject: [PATCH] Merge branch 'dev' of http://192.168.2.240:7070/r/kidgrow-microservices-platform into dev --- kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-server/src/main/java/com/kidgrow/usercenter/controller/SysRoleOrganizationController.java | 25 - kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/feign/RoleOrganizationService.java | 8 kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/SysProductMapper.xml | 179 +++++++---- kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderServiceImpl.java | 2 kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderRecordServiceImpl.java | 2 kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/SysProductServiceImpl.java | 7 kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderMapper.xml | 236 ++++++++------- kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml | 2 kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/feign/fallback/RoleOrganizationServiceFallbackFactory.java | 5 kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysDoctorMapper.xml | 240 ++++++++++----- kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderRecordMapper.xml | 132 ++++++-- kidgrow-config/src/main/resources/application-dev.properties | 16 12 files changed, 528 insertions(+), 326 deletions(-) diff --git a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/feign/RoleOrganizationService.java b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/feign/RoleOrganizationService.java index cb00255..7be1299 100644 --- a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/feign/RoleOrganizationService.java +++ b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/feign/RoleOrganizationService.java @@ -1,15 +1,13 @@ package com.kidgrow.oprationcenter.feign; import com.kidgrow.common.constant.ServiceNameConstants; -import com.kidgrow.common.model.SysRole; +import com.kidgrow.common.model.SysUser; import com.kidgrow.oprationcenter.feign.fallback.DiagnosticServiceFallbackFactory; import com.kidgrow.ribbon.config.FeignHttpInterceptorConfig; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestBody; -import java.util.List; import java.util.Map; /** @@ -27,5 +25,5 @@ * feign rpc访问远程 接口 */ @PostMapping(value = "/sysroleorganization/getRoleOrg") - Map<String, Object> getRoleOrgMap(List<SysRole> list) ; + Map<String, Object> getRoleOrgMap(@RequestBody SysUser sysUser) ; } diff --git a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/feign/fallback/RoleOrganizationServiceFallbackFactory.java b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/feign/fallback/RoleOrganizationServiceFallbackFactory.java index dcc8b33..8b892a4 100644 --- a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/feign/fallback/RoleOrganizationServiceFallbackFactory.java +++ b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/feign/fallback/RoleOrganizationServiceFallbackFactory.java @@ -1,13 +1,12 @@ package com.kidgrow.oprationcenter.feign.fallback; -import com.kidgrow.common.model.SysRole; +import com.kidgrow.common.model.SysUser; import com.kidgrow.oprationcenter.feign.RoleOrganizationService; import feign.hystrix.FallbackFactory; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.util.HashMap; -import java.util.List; import java.util.Map; @Slf4j @Component @@ -16,7 +15,7 @@ public RoleOrganizationService create(Throwable throwable) { return new RoleOrganizationService() { @Override - public Map<String, Object> getRoleOrgMap(List<SysRole> list) { + public Map<String, Object> getRoleOrgMap(SysUser sysUser) { Map<String, Object> map=new HashMap<>(); map.put("id",null); return map; diff --git a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderRecordServiceImpl.java b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderRecordServiceImpl.java index 9940f0d..113e57d 100644 --- a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderRecordServiceImpl.java +++ b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderRecordServiceImpl.java @@ -80,7 +80,7 @@ @Override public PageResult<ProductOrderJoinDetail> findAllList(Map<String, Object> params, SysUser sysUser) { Page<ProductOrderJoinDetail> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); - Map<String, Object> roleOrgMap = roleOrganizationService.getRoleOrgMap(sysUser.getRoles()); + Map<String, Object> roleOrgMap = roleOrganizationService.getRoleOrgMap(sysUser); params.putAll(roleOrgMap); List<ProductOrderJoinDetail> list = baseMapper.findAllList(page, params); for (ProductOrderJoinDetail productOrderJoinDetail : list) { diff --git a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderServiceImpl.java b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderServiceImpl.java index 87e3ca1..06ecc84 100644 --- a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderServiceImpl.java +++ b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderServiceImpl.java @@ -56,7 +56,7 @@ @Override public PageResult<ProductOrder> findList(Map<String, Object> params,@LoginUser SysUser sysUser){ Page<ProductOrder> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); - Map<String, Object> roleOrgMap = roleOrganizationService.getRoleOrgMap(sysUser.getRoles()); + Map<String, Object> roleOrgMap = roleOrganizationService.getRoleOrgMap(sysUser); params.putAll(roleOrgMap); List<ProductOrder> list = baseMapper.findList(page, params); return PageResult.<ProductOrder>builder().data(list).code(0).count(page.getTotal()).build(); diff --git a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/SysProductServiceImpl.java b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/SysProductServiceImpl.java index f491673..8ba559b 100644 --- a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/SysProductServiceImpl.java +++ b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/SysProductServiceImpl.java @@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Map; @@ -44,10 +45,12 @@ @Override public PageResult<SysProduct> findList(Map<String, Object> params, SysUser sysUser){ Page<SysProduct> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); - Map<String, Object> roleOrgMap = roleOrganizationService.getRoleOrgMap(sysUser.getRoles()); + Map<String, Object> roleOrgMap = roleOrganizationService.getRoleOrgMap(sysUser); params.putAll(roleOrgMap); + List<Long> longs = Arrays.asList(CommonConstant.PAY_USER_PRODUCT_ID, CommonConstant.REG_USER_PRODUCT_ID); + params.put("idNotIn",longs); List<SysProduct> list = baseMapper.findList(page, params); - list=list.stream().filter(f->(!f.getId().equals(CommonConstant.PAY_USER_PRODUCT_ID)&&!f.getId().equals(CommonConstant.REG_USER_PRODUCT_ID))).collect(Collectors.toList()); +// list=list.stream().filter(f->(!f.getId().equals(CommonConstant.PAY_USER_PRODUCT_ID)&&!f.getId().equals(CommonConstant.REG_USER_PRODUCT_ID))).collect(Collectors.toList()); return PageResult.<SysProduct>builder().data(list).code(0).count(page.getTotal()).build(); } /** diff --git a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml index 52bac30..c419e42 100644 --- a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml +++ b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml @@ -112,7 +112,7 @@ <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="com.kidgrow.oprationcenter.mapper.SysProductMapper.Role_Organization"></include>--> </where> </sql> <select id="groupProductDetail" resultType="com.kidgrow.oprationcenter.vo.GroupProductDetail"> diff --git a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderMapper.xml b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderMapper.xml index 7c788dc..cffb8ad 100644 --- a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderMapper.xml +++ b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderMapper.xml @@ -10,125 +10,139 @@ <!--sql查询片段--> <sql id="where"> <where> - <!--查询条件自行添加--> - is_del=0 - <if test="p.id != null and p.id !=''"> - and id = #{p.id} - </if> - <if test="p.hospitalId != null and p.hospitalId !=''"> - and hospital_id = #{p.hospitalId} - </if> - <if test="p.hospitalName != null and p.hospitalName !=''"> - and hospital_name like concat('%',#{p.hospitalName},'%') - </if> - <if test="p.departmentId != null and p.departmentId !=''"> - and department_id = #{p.departmentId} - </if> - <if test="p.departmentName != null and p.departmentName !=''"> - and department_name = #{p.departmentName} - </if> - <if test="p.contractNo != null and p.contractNo !=''"> - and contract_no = #{p.contractNo} - </if> - <if test="p.contractTitle != null and p.contractTitle !=''"> - and contract_title = #{p.contractTitle} - </if> - <if test="p.contractBeginTime != null and p.contractBeginTime !=''"> - and contract_begin_time = #{p.contractBeginTime} - </if> - <if test="p.contractEndTime != null and p.contractEndTime !=''"> - and contract_end_time = #{p.contractEndTime} - </if> - <if test="p.contractTime != null and p.contractTime !=''"> - and contract_time = #{p.contractTime} - </if> - <if test="p.isDel != null and p.isDel !=''"> - and is_del = #{p.isDel} - </if> - <if test="p.enabled != null and p.enabled !=''"> - and enabled = #{p.enabled} - </if> - <if test="p.updateTime != null and p.updateTime !=''"> - and update_time = #{p.updateTime} - </if> - <if test="p.createUserId != null and p.createUserId !=''"> - and create_user_id = #{p.createUserId} - </if> - <if test="p.createUserName != null and p.createUserName !=''"> - and create_user_name = #{p.createUserName} - </if> - <if test="p.updateUserId != null and p.updateUserId !=''"> - and update_user_id = #{p.updateUserId} - </if> - <if test="p.updateUserName != null and p.updateUserName !=''"> - and update_user_name = #{p.updateUserName} - </if> - <if test="p.createTime != null and p.createTime !=''"> - and create_time = #{p.createTime} - </if> + <include refid="where_condition"></include> </where> </sql> + <sql id="where_condition"> + <if test="p.id != null and p.id !=''"> + and id = #{p.id} + </if> + <if test="p.hospitalId != null and p.hospitalId !=''"> + and hospital_id = #{p.hospitalId} + </if> + <if test="p.hospitalName != null and p.hospitalName !=''"> + and hospital_name like concat('%',#{p.hospitalName},'%') + </if> + <if test="p.departmentId != null and p.departmentId !=''"> + and department_id = #{p.departmentId} + </if> + <if test="p.departmentName != null and p.departmentName !=''"> + and department_name = #{p.departmentName} + </if> + <if test="p.contractNo != null and p.contractNo !=''"> + and contract_no = #{p.contractNo} + </if> + <if test="p.contractTitle != null and p.contractTitle !=''"> + and contract_title = #{p.contractTitle} + </if> + <if test="p.contractBeginTime != null and p.contractBeginTime !=''"> + and contract_begin_time = #{p.contractBeginTime} + </if> + <if test="p.contractEndTime != null and p.contractEndTime !=''"> + and contract_end_time = #{p.contractEndTime} + </if> + <if test="p.contractTime != null and p.contractTime !=''"> + and contract_time = #{p.contractTime} + </if> + <if test="p.isDel != null and p.isDel !=''"> + and is_del = #{p.isDel} + </if> + <if test="p.enabled != null and p.enabled !=''"> + and enabled = #{p.enabled} + </if> + <if test="p.updateTime != null and p.updateTime !=''"> + and update_time = #{p.updateTime} + </if> + <if test="p.createUserId != null and p.createUserId !=''"> + and create_user_id = #{p.createUserId} + </if> + <if test="p.createUserName != null and p.createUserName !=''"> + and create_user_name = #{p.createUserName} + </if> + <if test="p.updateUserId != null and p.updateUserId !=''"> + and update_user_id = #{p.updateUserId} + </if> + <if test="p.updateUserName != null and p.updateUserName !=''"> + and update_user_name = #{p.updateUserName} + </if> + <if test="p.createTime != null and p.createTime !=''"> + and create_time = #{p.createTime} + </if> + </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 ( is_del = 0 and 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=""> + create_user_org_code = #{itemtoto.orgCode} + </foreach> + </if> + <if test="!itemto.flag"> + or ( + <foreach item="itemtoto" collection="itemto.object" separator="or" open="(" close=")" + index=""> + create_user_org_code = #{itemtoto.orgCode} + </foreach> + and is_del = 0 and enabled=1 <include refid="where_condition"></include> + ) + </if> + </when> + <when test="inx == 3"> + <if test="itemto.flag"> + AND + create_user_org_code = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (create_user_org_code = #{itemto.object} and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> + </when> + <when test="inx == 4"> + <if test="itemto.flag"> + AND + create_user_org_code like '${itemto.object}%' + </if> + <if test="!itemto.flag"> + or (create_user_org_code like '${itemto.object}%' and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> + </when> + <when test="inx == 5"> + <if test="itemto.flag"> + AND + create_user_id = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (create_user_id = #{itemto.object} and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> + </when> + <otherwise> + AND id is null + </otherwise> + </choose> + </foreach> + </foreach> + </if> + </sql> <!--sql查询片段--> <sql id="where_role"> <where> <!--查询条件自行添加--> is_del=0 - <if test="p.id != null and p.id !=''"> - and id = #{p.id} - </if> - <if test="p.hospitalId != null and p.hospitalId !=''"> - and hospital_id = #{p.hospitalId} - </if> - <if test="p.hospitalName != null and p.hospitalName !=''"> - and hospital_name like concat('%',#{p.hospitalName},'%') - </if> - <if test="p.departmentId != null and p.departmentId !=''"> - and department_id = #{p.departmentId} - </if> - <if test="p.departmentName != null and p.departmentName !=''"> - and department_name = #{p.departmentName} - </if> - <if test="p.contractNo != null and p.contractNo !=''"> - and contract_no = #{p.contractNo} - </if> - <if test="p.contractTitle != null and p.contractTitle !=''"> - and contract_title = #{p.contractTitle} - </if> - <if test="p.contractBeginTime != null and p.contractBeginTime !=''"> - and contract_begin_time = #{p.contractBeginTime} - </if> - <if test="p.contractEndTime != null and p.contractEndTime !=''"> - and contract_end_time = #{p.contractEndTime} - </if> - <if test="p.contractTime != null and p.contractTime !=''"> - and contract_time = #{p.contractTime} - </if> - <if test="p.isDel != null and p.isDel !=''"> - and is_del = #{p.isDel} - </if> - <if test="p.enabled != null and p.enabled !=''"> - and enabled = #{p.enabled} - </if> - <if test="p.updateTime != null and p.updateTime !=''"> - and update_time = #{p.updateTime} - </if> - <if test="p.createUserId != null and p.createUserId !=''"> - and create_user_id = #{p.createUserId} - </if> - <if test="p.createUserName != null and p.createUserName !=''"> - and create_user_name = #{p.createUserName} - </if> - <if test="p.updateUserId != null and p.updateUserId !=''"> - and update_user_id = #{p.updateUserId} - </if> - <if test="p.updateUserName != null and p.updateUserName !=''"> - and update_user_name = #{p.updateUserName} - </if> - <if test="p.createTime != null and p.createTime !=''"> - and create_time = #{p.createTime} - </if> - <include refid="com.kidgrow.oprationcenter.mapper.SysProductMapper.Role_Organization"></include> + <include refid="where_condition"></include> + <include refid="Role_Organization"></include> </where> </sql> <!--定义根据-ProductOrder当作查询条件返回对象--> 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..9c562d2 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,44 +84,114 @@ <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 ( is_del = 0 and 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=""> + create_user_org_code = #{itemtoto.orgCode} + </foreach> + </if> + <if test="!itemto.flag"> + or ( + <foreach item="itemtoto" collection="itemto.object" separator="or" open="(" close=")" + index=""> + create_user_org_code = #{itemtoto.orgCode} + </foreach> + and is_del = 0 and enabled=1 <include refid="where_condition"></include> + ) + </if> + </when> + <when test="inx == 3"> + <if test="itemto.flag"> + AND + create_user_org_code = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (create_user_org_code = #{itemto.object} and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> + </when> + <when test="inx == 4"> + <if test="itemto.flag"> + AND + create_user_org_code like '${itemto.object}%' + </if> + <if test="!itemto.flag"> + or (create_user_org_code like '${itemto.object}%' and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> + </when> + <when test="inx == 5"> + <if test="itemto.flag"> + AND + create_user_id = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (create_user_id = #{itemto.object} and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> + </when> + <otherwise> + AND id is null + </otherwise> + </choose> + </foreach> + </foreach> + </if> + </sql> <!--查询产品的消费记录--> <select id="findAllList" resultType="com.kidgrow.oprationcenter.vo.ProductOrderJoinDetail"> SELECT diff --git a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/SysProductMapper.xml b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/SysProductMapper.xml index ac9b12c..511cd55 100644 --- a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/SysProductMapper.xml +++ b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/SysProductMapper.xml @@ -9,99 +9,140 @@ <!--定义数据权限的查询--> <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"></when> + <when test="inx == 1"> + <if test="itemto.flag"> - <when test=" inx ==2"> - AND - <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> - create_user_org_code like '${itemtoto.orgCode}%' - </foreach> + </if> + <if test="!itemto.flag"> + or ( is_del = 0 and 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=""> + create_user_org_code = #{itemtoto.orgCode} + </foreach> + </if> + <if test="!itemto.flag"> + or ( + <foreach item="itemtoto" collection="itemto.object" separator="or" open="(" close=")" + index=""> + create_user_org_code = #{itemtoto.orgCode} + </foreach> + and is_del = 0 and enabled=1 <include refid="where_condition"></include> + ) + </if> </when> <when test="inx == 3"> - AND - <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> - create_user_org_code = #{itemtoto.orgCode} - </foreach> + <if test="itemto.flag"> + AND + create_user_org_code = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (create_user_org_code = #{itemto.object} and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> </when> <when test="inx == 4"> - AND - <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> - create_user_org_code like '${itemtoto.orgCode}%' - </foreach> + <if test="itemto.flag"> + AND + create_user_org_code like '${itemto.object}%' + </if> + <if test="!itemto.flag"> + or (create_user_org_code like '${itemto.object}%' and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> </when> <when test="inx == 5"> - AND - <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> - create_user_id = #{itemtoto.orgCode} - </foreach> + <if test="itemto.flag"> + AND + create_user_id = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (create_user_id = #{itemto.object} and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> </when> <otherwise> AND id is null </otherwise> </choose> - </foreach> </foreach> </if> </sql> + <sql id="where_condition"> + <if test="p.id != null and p.id !=''"> + and id = #{p.id} + </if> + <if test="p.proName != null and p.proName !=''"> + and pro_name like concat('%', #{p.proName}, '%') + </if> + <if test="p.proTime != null and p.proTime !=''"> + and pro_time = #{p.proTime} + </if> + <if test="p.proType != null and p.proType !=''"> + and pro_type = #{p.proType} + </if> + <if test="p.proPrice != null and p.proPrice !=''"> + and pro_price = #{p.proPrice} + </if> + <if test="p.recordCount != null and p.recordCount !=''"> + and record_count = #{p.recordCount} + </if> + <if test="p.ailightCount != null and p.ailightCount !=''"> + and ailight_count = #{p.ailightCount} + </if> + <if test="p.isDel != null and p.isDel !=''"> + and is_del = #{p.isDel} + </if> + <if test="p.enabled != null and p.enabled !=''"> + and enabled = #{p.enabled} + </if> + <if test="p.createUserId != null and p.createUserId !=''"> + and create_user_id = #{p.createUserId} + </if> + <if test="p.createUserName != null and p.createUserName !=''"> + and create_user_name = #{p.createUserName} + </if> + <if test="p.updateUserId != null and p.updateUserId !=''"> + and update_user_id = #{p.updateUserId} + </if> + <if test="p.updateUserName != null and p.updateUserName !=''"> + and update_user_name = #{p.updateUserName} + </if> + <if test="p.createTime != null and p.createTime !=''"> + and create_time = #{p.createTime} + </if> + <if test="p.updateTime != null and p.updateTime !=''"> + and update_time = #{p.updateTime} + </if> + <if test="p.idNotIn !=null and p.idNotIn.size()>0"> + and id not in + <foreach item="list" collection="p.idNotIn" separator="," open="(" close=")" + index=""> + #{list} + </foreach> + </if> + </sql> +<!-- 根据数据权限查询数据--> + <sql id="where_list"> + <where> + <!--查询条件自行添加--> + is_del=0 + <include refid="where_condition"></include> + <include refid="Role_Organization"></include> + </where> + </sql> <!--sql查询片段--> <sql id="where"> <where> <!--查询条件自行添加--> is_del=0 - <if test="p.id != null and p.id !=''"> - and id = #{p.id} - </if> - <if test="p.proName != null and p.proName !=''"> - and pro_name like concat('%', #{p.proName}, '%') - </if> - <if test="p.proTime != null and p.proTime !=''"> - and pro_time = #{p.proTime} - </if> - <if test="p.proType != null and p.proType !=''"> - and pro_type = #{p.proType} - </if> - <if test="p.proPrice != null and p.proPrice !=''"> - and pro_price = #{p.proPrice} - </if> - <if test="p.recordCount != null and p.recordCount !=''"> - and record_count = #{p.recordCount} - </if> - <if test="p.ailightCount != null and p.ailightCount !=''"> - and ailight_count = #{p.ailightCount} - </if> - <if test="p.isDel != null and p.isDel !=''"> - and is_del = #{p.isDel} - </if> - <if test="p.enabled != null and p.enabled !=''"> - and enabled = #{p.enabled} - </if> - <if test="p.createUserId != null and p.createUserId !=''"> - and create_user_id = #{p.createUserId} - </if> - <if test="p.createUserName != null and p.createUserName !=''"> - and create_user_name = #{p.createUserName} - </if> - <if test="p.updateUserId != null and p.updateUserId !=''"> - and update_user_id = #{p.updateUserId} - </if> - <if test="p.updateUserName != null and p.updateUserName !=''"> - and update_user_name = #{p.updateUserName} - </if> - <if test="p.createTime != null and p.createTime !=''"> - and create_time = #{p.createTime} - </if> - <if test="p.updateTime != null and p.updateTime !=''"> - and update_time = #{p.updateTime} - </if> - <include refid="Role_Organization"></include> + <include refid="where_condition"></include> </where> </sql> @@ -120,7 +161,7 @@ select <include refid="Column_List"/> from sys_product - <include refid="where"/> + <include refid="where_list"/> order by id desc </select> <!--定义根据-SysProduct当作查询条件返回对象集合--> diff --git a/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysDoctorMapper.xml b/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysDoctorMapper.xml index 04094cf..bc60271 100644 --- a/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysDoctorMapper.xml +++ b/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysDoctorMapper.xml @@ -6,91 +6,169 @@ <sql id="Column_List"> DISTINCT * </sql> - + <sql id="where_condition"> + <if test="p.id != null and p.id !=''"> + and id = #{p.id} + </if> + <if test="p.userId != null and p.userId !=''"> + and user_id = #{p.userId} + </if> + <if test="p.hospitalId != null and p.hospitalId !=''"> + and hospital_id = #{p.hospitalId} + </if> + <if test="p.hospitalName != null and p.hospitalName !=''"> + and hospital_name like '%${p.hospitalName}%' + </if> + <if test="p.departmentId != null and p.departmentId !=''"> + and department_id = #{p.departmentId} + </if> + <if test="p.departmentName != null and p.departmentName !=''"> + and department_name = #{p.departmentName} + </if> + <if test="p.doctorName != null and p.doctorName !=''"> + and doctor_name like '%${p.doctorName}%' + </if> + <if test="p.doctorLogo != null and p.doctorLogo !=''"> + and doctor_logo = #{p.doctorLogo} + </if> + <if test="p.doctorTel != null and p.doctorTel !=''"> + and doctor_tel like concat('%',#{p.doctorTel},'%') + </if> + <if test="p.doctorRankId != null and p.doctorRankId !=''"> + and doctor_rank_id = #{p.doctorRankId} + </if> + <if test="p.doctorRank != null and p.doctorRank !=''"> + and doctor_rank = #{p.doctorRank} + </if> + <if test="p.doctorOtherLink != null and p.doctorOtherLink !=''"> + and doctor_other_link = #{p.doctorOtherLink} + </if> + <if test="p.doctorEmail != null and p.doctorEmail !=''"> + and doctor_email = #{p.doctorEmail} + </if> + <if test="p.doctorAbout != null and p.doctorAbout !=''"> + and doctor_about = #{p.doctorAbout} + </if> + <if test="p.isAnswer != null and p.isAnswer !=''"> + and is_answer = #{p.isAnswer} + </if> + <if test="p.isSigning != null and p.isSigning !=''"> + and is_signing = #{p.isSigning} + </if> + <if test="p.isTop != null and p.isTop !=''"> + and is_top = #{p.isTop} + </if> + <if test="p.isDel != null and p.isDel !=''"> + and is_del = #{p.isDel} + </if> + <if test="p.doctorState != null and p.doctorState !=''"> + and doctor_state = #{p.doctorState} + </if> + <if test="p.enabled != null and p.enabled !=''"> + and enabled = #{p.enabled} + </if> + <if test="p.createUserId != null and p.createUserId !=''"> + and create_user_id = #{p.createUserId} + </if> + <if test="p.createUserName != null and p.createUserName !=''"> + and create_user_name = #{p.createUserName} + </if> + <if test="p.updateUserId != null and p.updateUserId !=''"> + and update_user_id = #{p.updateUserId} + </if> + <if test="p.updateUserName != null and p.updateUserName !=''"> + and update_user_name = #{p.updateUserName} + </if> + <if test="p.createTime != null and p.createTime !=''"> + and create_time = #{p.createTime} + </if> + <if test="p.updateTime != null and p.updateTime !=''"> + and update_time = #{p.updateTime} + </if> + </sql> <!--sql查询片段--> + <sql id="where_list"> + <where> + <!--查询条件自行添加--> + is_del=0 + <include refid="where_condition"></include> + <include refid="Role_Organization"/> + </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 ( is_del = 0 and 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=""> + create_user_org_code = #{itemtoto.orgCode} + </foreach> + </if> + <if test="!itemto.flag"> + or ( + <foreach item="itemtoto" collection="itemto.object" separator="or" open="(" close=")" + index=""> + create_user_org_code = #{itemtoto.orgCode} + </foreach> + and is_del = 0 and enabled=1 <include refid="where_condition"></include> + ) + </if> + </when> + <when test="inx == 3"> + <if test="itemto.flag"> + AND + create_user_org_code = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (create_user_org_code = #{itemto.object} and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> + </when> + <when test="inx == 4"> + <if test="itemto.flag"> + AND + create_user_org_code like '${itemto.object}%' + </if> + <if test="!itemto.flag"> + or (create_user_org_code like '${itemto.object}%' and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> + </when> + <when test="inx == 5"> + <if test="itemto.flag"> + AND + create_user_id = #{itemto.object} + </if> + <if test="!itemto.flag"> + or (create_user_id = #{itemto.object} and is_del = 0 and enabled=1) <include refid="where_condition"></include> + </if> + </when> + <otherwise> + AND id is null + </otherwise> + </choose> + </foreach> + </foreach> + </if> + </sql> + <sql id="where"> <where> <!--查询条件自行添加--> is_del=0 - <if test="p.id != null and p.id !=''"> - and id = #{p.id} - </if> - <if test="p.userId != null and p.userId !=''"> - and user_id = #{p.userId} - </if> - <if test="p.hospitalId != null and p.hospitalId !=''"> - and hospital_id = #{p.hospitalId} - </if> - <if test="p.hospitalName != null and p.hospitalName !=''"> - and hospital_name like '%${p.hospitalName}%' - </if> - <if test="p.departmentId != null and p.departmentId !=''"> - and department_id = #{p.departmentId} - </if> - <if test="p.departmentName != null and p.departmentName !=''"> - and department_name = #{p.departmentName} - </if> - <if test="p.doctorName != null and p.doctorName !=''"> - and doctor_name like '%${p.doctorName}%' - </if> - <if test="p.doctorLogo != null and p.doctorLogo !=''"> - and doctor_logo = #{p.doctorLogo} - </if> - <if test="p.doctorTel != null and p.doctorTel !=''"> - and doctor_tel like concat('%',#{p.doctorTel},'%') - </if> - <if test="p.doctorRankId != null and p.doctorRankId !=''"> - and doctor_rank_id = #{p.doctorRankId} - </if> - <if test="p.doctorRank != null and p.doctorRank !=''"> - and doctor_rank = #{p.doctorRank} - </if> - <if test="p.doctorOtherLink != null and p.doctorOtherLink !=''"> - and doctor_other_link = #{p.doctorOtherLink} - </if> - <if test="p.doctorEmail != null and p.doctorEmail !=''"> - and doctor_email = #{p.doctorEmail} - </if> - <if test="p.doctorAbout != null and p.doctorAbout !=''"> - and doctor_about = #{p.doctorAbout} - </if> - <if test="p.isAnswer != null and p.isAnswer !=''"> - and is_answer = #{p.isAnswer} - </if> - <if test="p.isSigning != null and p.isSigning !=''"> - and is_signing = #{p.isSigning} - </if> - <if test="p.isTop != null and p.isTop !=''"> - and is_top = #{p.isTop} - </if> - <if test="p.isDel != null and p.isDel !=''"> - and is_del = #{p.isDel} - </if> - <if test="p.doctorState != null and p.doctorState !=''"> - and doctor_state = #{p.doctorState} - </if> - <if test="p.enabled != null and p.enabled !=''"> - and enabled = #{p.enabled} - </if> - <if test="p.createUserId != null and p.createUserId !=''"> - and create_user_id = #{p.createUserId} - </if> - <if test="p.createUserName != null and p.createUserName !=''"> - and create_user_name = #{p.createUserName} - </if> - <if test="p.updateUserId != null and p.updateUserId !=''"> - and update_user_id = #{p.updateUserId} - </if> - <if test="p.updateUserName != null and p.updateUserName !=''"> - and update_user_name = #{p.updateUserName} - </if> - <if test="p.createTime != null and p.createTime !=''"> - and create_time = #{p.createTime} - </if> - <if test="p.updateTime != null and p.updateTime !=''"> - and update_time = #{p.updateTime} - </if> - <include refid="com.kidgrow.usercenter.mapper.SysRoleOrganizationMapper.Role_Organization"/> + <include refid="where_condition"></include> </where> </sql> @@ -109,7 +187,7 @@ select <include refid="Column_List"/> from sys_doctor - <include refid="where"/> + <include refid="where_list"/> order by id desc </select> diff --git a/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-server/src/main/java/com/kidgrow/usercenter/controller/SysRoleOrganizationController.java b/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-server/src/main/java/com/kidgrow/usercenter/controller/SysRoleOrganizationController.java index ed5f2fc..90171ac 100644 --- a/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-server/src/main/java/com/kidgrow/usercenter/controller/SysRoleOrganizationController.java +++ b/kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-server/src/main/java/com/kidgrow/usercenter/controller/SysRoleOrganizationController.java @@ -1,34 +1,29 @@ package com.kidgrow.usercenter.controller; -import java.util.Map; - import com.kidgrow.common.annotation.LoginUser; import com.kidgrow.common.constant.SecurityConstants; import com.kidgrow.common.controller.BaseController; +import com.kidgrow.common.model.PageResult; +import com.kidgrow.common.model.ResultBody; +import com.kidgrow.common.model.SysUser; import com.kidgrow.usercenter.dto.SysRoleOrganizationDto; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import com.kidgrow.usercenter.model.SysRoleOrganization; +import com.kidgrow.usercenter.service.ISysRoleOrganizationService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; - -import com.kidgrow.usercenter.model.SysRoleOrganization; -import com.kidgrow.usercenter.service.ISysRoleOrganizationService; -import com.kidgrow.common.model.*; - +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.validation.ObjectError; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Set; /** @@ -114,10 +109,8 @@ } @ApiOperation(value = "获取数据权限的map") @PostMapping("getRoleOrg") - public Map<String, Object> getRoleOrgMap(@RequestBody List<SysRole> list) { - SysUser user=new SysUser(); - user.setRoles(list); - return sysRoleOrganizationService.getRoleOrgMap(user); + public Map<String, Object> getRoleOrgMap(@RequestBody SysUser sysUser) { + return sysRoleOrganizationService.getRoleOrgMap(sysUser); } /** diff --git a/kidgrow-config/src/main/resources/application-dev.properties b/kidgrow-config/src/main/resources/application-dev.properties index 3d80c8c..6986243 100644 --- a/kidgrow-config/src/main/resources/application-dev.properties +++ b/kidgrow-config/src/main/resources/application-dev.properties @@ -74,11 +74,17 @@ ## appUrl \u9759\u6001\u6587\u4EF6\u4E0A\u4F20\u8DEF\u5F84 appUrl=http://192.168.2.240/upload/ -## C\u7AEF\u4EA7\u54C1\u516C\u4F17\u53F7\u914D\u7F6E\u4FE1\u606F +## \u5FAE\u4FE1\u7EDF\u4E00URL wechat.apiUrl=https://api.weixin.qq.com -wechat.mp.appid=dev-wx1cc7074ce3014652 -wechat.mp.secret=dev-0fa9eb188ae52aa8c2380744109f161c -## C\u7AEF\u4EA7\u54C1\u5C0F\u7A0B\u5E8F\u914D\u7F6E\u4FE1\u606F +## H\u7AEF\u4EA7\u54C1\u9AA8\u9F84\u5C0F\u7A0B\u5E8F\u914D\u7F6E\u4FE1\u606F wechat.miniapp.appid=wx5a9bc7ebd13eb6cc -wechat.miniapp.secret=c16d8e42e42137bd7ba6e6999f226803 \ No newline at end of file +wechat.miniapp.secret=c16d8e42e42137bd7ba6e6999f226803 + +## C\u7AEF\u4EA7\u54C1\u516C\u4F17\u53F7\u914D\u7F6E\u4FE1\u606F +wechat.xigao.mp.appid=dev-wx1cc7074ce3014652 +wechat.xigao.mp.secret=dev-0fa9eb188ae52aa8c2380744109f161c + +## C\u7AEF\u4EA7\u54C1\u53EF\u7231\u9AD8\u7B5B\u67E5\u5C0F\u7A0B\u5E8F\u914D\u7F6E\u4FE1\u606F +wechat.screening.applets.appid=wx5a9bc7ebd13eb6cc +wechat.screening.applets.secret=c16d8e42e42137bd7ba6e6999f226803 \ No newline at end of file -- Gitblit v1.8.0