优化接口。

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());
List<String> cpUserIds = privilageCpUserStoreDOMapper.selectCpUserIdsByStoreIds(shopIdList);
Long all = privilageCpUserDOMapper.selectStoresCount(cpUserIds);
Long dis = privilageCpUserDOMapper.selectDistinctStoresCount(cpUserIds);
List<Map<String, String>> dis = privilageCpUserDOMapper.selectDistinctStoresCount(cpUserIds);
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())) {
Long all = privilageCpUserDOMapper.selectAllCount();
Long dis = privilageCpUserDOMapper.selectDistinctAllCount();
List<Map<String, String>> dis = privilageCpUserDOMapper.selectDistinctAllCount();
result.setAllCustomer(all);
result.setAllValidCustomer(dis);
if(null != dis){
result.setAllValidCustomer(Long.parseLong(dis.get(0).get("rows")));
}
}
return result;

@ -19,7 +19,7 @@ public interface PrivilageCpUserDOMapper extends BaseMapper<PrivilageCpUserDO> {
Long selectAllCount();
Long selectDistinctAllCount();
List<Map<String, String>> selectDistinctAllCount();
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 selectDistinctStoresCount(@Param("cpUserIds")List<String> cpUserIds);
List<Map<String, String>> selectDistinctStoresCount(@Param("cpUserIds")List<String> cpUserIds);
Long selectStoresCountById(@Param("shopIds")List<Long> shopIds);

@ -22,8 +22,8 @@
select count(id) from op_cp_user_customer_relation
</select>
<select id="selectDistinctAllCount" resultType="java.lang.Long">
select count(distinct customer_user_id) from op_cp_user_customer_relation
<select id="selectDistinctAllCount" resultType="java.util.Map">
EXPLAIN select count(distinct customer_user_id) from op_cp_user_customer_relation
</select>
<select id="selectStoreCount" resultType="java.lang.Long">
@ -38,8 +38,8 @@
</foreach>
</select>
<select id="selectDistinctStoresCount" resultType="java.lang.Long">
select count(distinct customer_user_id) from op_cp_user_customer_relation where cp_user_id in
<select id="selectDistinctStoresCount" resultType="java.util.Map">
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="(">
#{item}
</foreach>

Loading…
Cancel
Save