优化接口。

dev
kevin jiang 5 years ago
parent d27a23905e
commit e4067e7703

@ -665,18 +665,23 @@ public class CustomerViewService {
shopIdList = list1.stream().map(PoiStore::getId).collect(Collectors.toList()); shopIdList = list1.stream().map(PoiStore::getId).collect(Collectors.toList());
List<String> cpUserIds = privilageCpUserStoreDOMapper.selectCpUserIdsByStoreIds(shopIdList); List<String> cpUserIds = privilageCpUserStoreDOMapper.selectCpUserIdsByStoreIds(shopIdList);
Long all = privilageCpUserDOMapper.selectStoresCount(cpUserIds); Long all = privilageCpUserDOMapper.selectStoresCount(cpUserIds);
Long dis = privilageCpUserDOMapper.selectDistinctStoresCount(cpUserIds); List<Map<String, String>> dis = privilageCpUserDOMapper.selectDistinctStoresCount(cpUserIds);
result.setAllCustomer(all); result.setAllCustomer(all);
result.setAllValidCustomer(dis); if(null != dis){
result.setAllValidCustomer(Long.parseLong(dis.get(0).get("rows")));
}
} }
//管理员/总运营人员 //管理员/总运营人员
else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_GLY.getRoleCode()) || privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_ALL_YYRY.getRoleCode())) { else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_GLY.getRoleCode()) || privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_ALL_YYRY.getRoleCode())) {
Long all = privilageCpUserDOMapper.selectAllCount(); Long all = privilageCpUserDOMapper.selectAllCount();
Long dis = privilageCpUserDOMapper.selectDistinctAllCount(); List<Map<String, String>> dis = privilageCpUserDOMapper.selectDistinctAllCount();
result.setAllCustomer(all); result.setAllCustomer(all);
result.setAllValidCustomer(dis); if(null != dis){
result.setAllValidCustomer(Long.parseLong(dis.get(0).get("rows")));
}
} }
return result; return result;

@ -19,7 +19,7 @@ public interface PrivilageCpUserDOMapper extends BaseMapper<PrivilageCpUserDO> {
Long selectAllCount(); Long selectAllCount();
Long selectDistinctAllCount(); List<Map<String, String>> selectDistinctAllCount();
List<String> selectCustomerIdsByCpUserId(@Param("cpUserId")String cpUserId); List<String> selectCustomerIdsByCpUserId(@Param("cpUserId")String cpUserId);
@ -29,7 +29,7 @@ public interface PrivilageCpUserDOMapper extends BaseMapper<PrivilageCpUserDO> {
Long selectStoresCount(@Param("cpUserIds")List<String> cpUserIds); Long selectStoresCount(@Param("cpUserIds")List<String> cpUserIds);
Long selectDistinctStoresCount(@Param("cpUserIds")List<String> cpUserIds); List<Map<String, String>> selectDistinctStoresCount(@Param("cpUserIds")List<String> cpUserIds);
Long selectStoresCountById(@Param("shopIds")List<Long> shopIds); Long selectStoresCountById(@Param("shopIds")List<Long> shopIds);

@ -22,8 +22,8 @@
select count(id) from op_cp_user_customer_relation select count(id) from op_cp_user_customer_relation
</select> </select>
<select id="selectDistinctAllCount" resultType="java.lang.Long"> <select id="selectDistinctAllCount" resultType="java.util.Map">
select count(distinct customer_user_id) from op_cp_user_customer_relation EXPLAIN select count(distinct customer_user_id) from op_cp_user_customer_relation
</select> </select>
<select id="selectStoreCount" resultType="java.lang.Long"> <select id="selectStoreCount" resultType="java.lang.Long">
@ -38,8 +38,8 @@
</foreach> </foreach>
</select> </select>
<select id="selectDistinctStoresCount" resultType="java.lang.Long"> <select id="selectDistinctStoresCount" resultType="java.util.Map">
select count(distinct customer_user_id) from op_cp_user_customer_relation where cp_user_id in EXPLAIN select count(distinct customer_user_id) from op_cp_user_customer_relation where cp_user_id in
<foreach collection="cpUserIds" separator="," item="item" close=")" index="index" open="("> <foreach collection="cpUserIds" separator="," item="item" close=")" index="index" open="(">
#{item} #{item}
</foreach> </foreach>

Loading…
Cancel
Save