Commit 54c374edf023672ff022044e67f86186a0084a21

Authored by 陈威
1 parent 832541cf
Exists in dev

修复查询拜访中手动新增的用户

zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/controller/McVisitUserController.java
... ... @@ -34,7 +34,8 @@ public class McVisitUserController extends BaseController
34 34 public TableDataInfo list(McVisitUser mcVisitUser)
35 35 {
36 36 startPage();
37   - List<McVisitUser> list = mcVisitUserService.selectMcVisitUserList(mcVisitUser);
  37 + List<McVisitUser> list = mcVisitUserService.selectMcVisitUserByVlgOrCmtys
  38 + (mcVisitUser);
38 39 return getDataTable(list);
39 40 }
40 41 }
... ...
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/mapper/McVisitUserMapper.java
1 1 package com.chinagas.modules.schsf.mapper;
2 2  
3   -import java.util.List;
4 3 import com.chinagas.modules.schsf.domain.McVisitUser;
5 4  
  5 +import java.util.List;
  6 +
6 7 /**
7 8 * 百万用户信息(被拜访的用户)Mapper接口
8   - *
  9 + *
9 10 * @author cw
10 11 * @date 2024-05-30
11 12 */
12   -public interface McVisitUserMapper
  13 +public interface McVisitUserMapper
13 14 {
14 15 /**
15 16 * 查询百万用户信息(被拜访的用户)
16   - *
  17 + *
17 18 * @param id 百万用户信息(被拜访的用户)主键
18 19 * @return 百万用户信息(被拜访的用户)
19 20 */
... ... @@ -21,7 +22,7 @@ public interface McVisitUserMapper
21 22  
22 23 /**
23 24 * 查询百万用户信息(被拜访的用户)列表
24   - *
  25 + *
25 26 * @param mcVisitUser 百万用户信息(被拜访的用户)
26 27 * @return 百万用户信息(被拜访的用户)集合
27 28 */
... ... @@ -29,7 +30,7 @@ public interface McVisitUserMapper
29 30  
30 31 /**
31 32 * 新增百万用户信息(被拜访的用户)
32   - *
  33 + *
33 34 * @param mcVisitUser 百万用户信息(被拜访的用户)
34 35 * @return 结果
35 36 */
... ... @@ -37,7 +38,7 @@ public interface McVisitUserMapper
37 38  
38 39 /**
39 40 * 修改百万用户信息(被拜访的用户)
40   - *
  41 + *
41 42 * @param mcVisitUser 百万用户信息(被拜访的用户)
42 43 * @return 结果
43 44 */
... ... @@ -45,7 +46,7 @@ public interface McVisitUserMapper
45 46  
46 47 /**
47 48 * 删除百万用户信息(被拜访的用户)
48   - *
  49 + *
49 50 * @param id 百万用户信息(被拜访的用户)主键
50 51 * @return 结果
51 52 */
... ... @@ -53,9 +54,12 @@ public interface McVisitUserMapper
53 54  
54 55 /**
55 56 * 批量删除百万用户信息(被拜访的用户)
56   - *
  57 + *
57 58 * @param ids 需要删除的数据主键集合
58 59 * @return 结果
59 60 */
60 61 public int deleteMcVisitUserByIds(Long[] ids);
  62 +
  63 + List<McVisitUser> selectMcVisitUserByVlgOrCmtys(McVisitUser mcVisitUser);
  64 +
61 65 }
... ...
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/service/IMcVisitUserService.java
1 1 package com.chinagas.modules.schsf.service;
2 2  
3   -import java.util.List;
4 3 import com.chinagas.modules.schsf.domain.McVisitUser;
5 4  
  5 +import java.util.List;
  6 +
6 7 /**
7 8 * 百万用户信息(被拜访的用户)Service接口
8   - *
  9 + *
9 10 * @author cw
10 11 * @date 2024-05-30
11 12 */
12   -public interface IMcVisitUserService
  13 +public interface IMcVisitUserService
13 14 {
14 15 /**
15 16 * 查询百万用户信息(被拜访的用户)
16   - *
  17 + *
17 18 * @param id 百万用户信息(被拜访的用户)主键
18 19 * @return 百万用户信息(被拜访的用户)
19 20 */
... ... @@ -21,7 +22,7 @@ public interface IMcVisitUserService
21 22  
22 23 /**
23 24 * 查询百万用户信息(被拜访的用户)列表
24   - *
  25 + *
25 26 * @param mcVisitUser 百万用户信息(被拜访的用户)
26 27 * @return 百万用户信息(被拜访的用户)集合
27 28 */
... ... @@ -29,7 +30,7 @@ public interface IMcVisitUserService
29 30  
30 31 /**
31 32 * 新增百万用户信息(被拜访的用户)
32   - *
  33 + *
33 34 * @param mcVisitUser 百万用户信息(被拜访的用户)
34 35 * @return 结果
35 36 */
... ... @@ -37,7 +38,7 @@ public interface IMcVisitUserService
37 38  
38 39 /**
39 40 * 修改百万用户信息(被拜访的用户)
40   - *
  41 + *
41 42 * @param mcVisitUser 百万用户信息(被拜访的用户)
42 43 * @return 结果
43 44 */
... ... @@ -45,7 +46,7 @@ public interface IMcVisitUserService
45 46  
46 47 /**
47 48 * 批量删除百万用户信息(被拜访的用户)
48   - *
  49 + *
49 50 * @param ids 需要删除的百万用户信息(被拜访的用户)主键集合
50 51 * @return 结果
51 52 */
... ... @@ -53,9 +54,13 @@ public interface IMcVisitUserService
53 54  
54 55 /**
55 56 * 删除百万用户信息(被拜访的用户)信息
56   - *
  57 + *
57 58 * @param id 百万用户信息(被拜访的用户)主键
58 59 * @return 结果
59 60 */
60 61 public int deleteMcVisitUserById(Long id);
  62 +
  63 + List<McVisitUser> selectMcVisitUserByVlgOrCmtys(McVisitUser mcVisitUser);
  64 +
  65 +
61 66 }
... ...
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/service/impl/McVisitUserServiceImpl.java
1 1 package com.chinagas.modules.schsf.service.impl;
2 2  
3   -import java.util.List;
4 3 import com.chinagas.common.core.utils.DateUtils;
5   -import org.springframework.beans.factory.annotation.Autowired;
6   -import org.springframework.stereotype.Service;
7   -import com.chinagas.modules.schsf.mapper.McVisitUserMapper;
8 4 import com.chinagas.modules.schsf.domain.McVisitUser;
  5 +import com.chinagas.modules.schsf.mapper.McVisitUserMapper;
9 6 import com.chinagas.modules.schsf.service.IMcVisitUserService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +import java.util.Collections;
  11 +import java.util.List;
10 12  
11 13 /**
12 14 * 百万用户信息(被拜访的用户)Service业务层处理
13   - *
  15 + *
14 16 * @author cw
15 17 * @date 2024-05-30
16 18 */
17 19 @Service
18   -public class McVisitUserServiceImpl implements IMcVisitUserService
  20 +public class McVisitUserServiceImpl implements IMcVisitUserService
19 21 {
20 22 @Autowired
21 23 private McVisitUserMapper mcVisitUserMapper;
22 24  
23 25 /**
24 26 * 查询百万用户信息(被拜访的用户)
25   - *
  27 + *
26 28 * @param id 百万用户信息(被拜访的用户)主键
27 29 * @return 百万用户信息(被拜访的用户)
28 30 */
... ... @@ -34,7 +36,7 @@ public class McVisitUserServiceImpl implements IMcVisitUserService
34 36  
35 37 /**
36 38 * 查询百万用户信息(被拜访的用户)列表
37   - *
  39 + *
38 40 * @param mcVisitUser 百万用户信息(被拜访的用户)
39 41 * @return 百万用户信息(被拜访的用户)
40 42 */
... ... @@ -46,7 +48,7 @@ public class McVisitUserServiceImpl implements IMcVisitUserService
46 48  
47 49 /**
48 50 * 新增百万用户信息(被拜访的用户)
49   - *
  51 + *
50 52 * @param mcVisitUser 百万用户信息(被拜访的用户)
51 53 * @return 结果
52 54 */
... ... @@ -59,7 +61,7 @@ public class McVisitUserServiceImpl implements IMcVisitUserService
59 61  
60 62 /**
61 63 * 修改百万用户信息(被拜访的用户)
62   - *
  64 + *
63 65 * @param mcVisitUser 百万用户信息(被拜访的用户)
64 66 * @return 结果
65 67 */
... ... @@ -71,7 +73,7 @@ public class McVisitUserServiceImpl implements IMcVisitUserService
71 73  
72 74 /**
73 75 * 批量删除百万用户信息(被拜访的用户)
74   - *
  76 + *
75 77 * @param ids 需要删除的百万用户信息(被拜访的用户)主键
76 78 * @return 结果
77 79 */
... ... @@ -83,7 +85,7 @@ public class McVisitUserServiceImpl implements IMcVisitUserService
83 85  
84 86 /**
85 87 * 删除百万用户信息(被拜访的用户)信息
86   - *
  88 + *
87 89 * @param id 百万用户信息(被拜访的用户)主键
88 90 * @return 结果
89 91 */
... ... @@ -92,4 +94,9 @@ public class McVisitUserServiceImpl implements IMcVisitUserService
92 94 {
93 95 return mcVisitUserMapper.deleteMcVisitUserById(id);
94 96 }
  97 +
  98 + @Override
  99 + public List<McVisitUser> selectMcVisitUserByVlgOrCmtys(McVisitUser mcVisitUser) {
  100 + return mcVisitUserMapper.selectMcVisitUserByVlgOrCmtys(mcVisitUser);
  101 + }
95 102 }
... ...
zr-cloud/zr-modules/zr-schsf/src/main/resources/mapper/McVisitUserMapper.xml
... ... @@ -193,4 +193,53 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
193 193 #{id}
194 194 </foreach>
195 195 </delete>
  196 +
  197 + <select id="selectMcVisitUserByVlgOrCmtys" resultMap="McVisitUserResult" parameterType="com.chinagas.modules.schsf.domain.McVisitUser">
  198 + SELECT user_code, user_name, user_phone, residence_type, family_members, income_source, house_condition, original_appliances, decoration_status, current_cooking_energy, current_heating_energy, is_intent, region_name, region_code, budget_owner, company_name, company_code , province, city,district,street,detailed_address, fridge_status, ac_status, tv_status, washer_status,water_heater_status, pv_system_status, township, village, vlg_or_cmty, user_age, create_time, create_by, def_flag
  199 + FROM mc_visit_user
  200 + where 1=1
  201 + <if test="userCode != null and userCode != ''"> and user_code = #{userCode}</if>
  202 + <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
  203 + <if test="userPhone != null and userPhone != ''"> and user_phone = #{userPhone}</if>
  204 + <if test="residenceType != null and residenceType != ''"> and residence_type = #{residenceType}</if>
  205 + <if test="familyMembers != null and familyMembers != ''"> and family_members = #{familyMembers}</if>
  206 + <if test="incomeSource != null and incomeSource != ''"> and income_source = #{incomeSource}</if>
  207 + <if test="houseCondition != null and houseCondition != ''"> and house_condition = #{houseCondition}</if>
  208 + <if test="originalAppliances != null and originalAppliances != ''"> and original_appliances = #{originalAppliances}</if>
  209 + <if test="decorationStatus != null and decorationStatus != ''"> and decoration_status = #{decorationStatus}</if>
  210 + <if test="currentCookingEnergy != null and currentCookingEnergy != ''"> and current_cooking_energy = #{currentCookingEnergy}</if>
  211 + <if test="currentHeatingEnergy != null and currentHeatingEnergy != ''"> and current_heating_energy = #{currentHeatingEnergy}</if>
  212 + <if test="isIntent != null and isIntent != ''"> and is_intent = #{isIntent}</if>
  213 + <if test="regionName != null and regionName != ''"> and region_name like concat('%', #{regionName}, '%')</if>
  214 + <if test="regionCode != null and regionCode != ''"> and region_code = #{regionCode}</if>
  215 + <if test="budgetOwner != null and budgetOwner != ''"> and budget_owner = #{budgetOwner}</if>
  216 + <if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
  217 + <if test="companyCode != null and companyCode != ''"> and company_code = #{companyCode}</if>
  218 + <if test="province != null and province != ''"> and province = #{province}</if>
  219 + <if test="city != null and city != ''"> and city = #{city}</if>
  220 + <if test="district != null and district != ''"> and district = #{district}</if>
  221 + <if test="street != null and street != ''"> and street = #{street}</if>
  222 + <if test="detailedAddress != null and detailedAddress != ''"> and detailed_address = #{detailedAddress}</if>
  223 + <if test="township != null and township != ''"> and township = #{township}</if>
  224 + <if test="village != null and village != ''"> and village = #{village}</if>
  225 + <if test="vlgOrCmty != null and vlgOrCmty != ''"> and vlg_or_cmty = #{vlgOrCmty}</if>
  226 + <if test="userAge != null and userAge != ''"> and user_age = #{userAge}</if>
  227 + <if test="defFlag != null and defFlag != ''"> and def_flag = #{defFlag}</if>
  228 + UNION
  229 + SELECT DISTINCT v.user_code, v.user_name, v.user_phone,null ,v.family_members,null,v.house_condition,
  230 + null,null ,v.current_cooking_energy,v.current_heating_energy,v.is_intent,v.region_name,null,null,v.company_name,v.company_code,
  231 + v.user_province as province,v.user_city as city,v.user_district as district,v.user_street as street,v.user_detailed_address as detailed_address,
  232 + v.fridge_status, ac_status,v.tv_status, v.washer_status,v.water_heater_status,v.pv_system_status,null ,null ,v.vlg_or_cmty ,null ,null,null,null
  233 + FROM mc_visit v
  234 + INNER JOIN (
  235 + SELECT DISTINCT u.user_name, u.user_phone,max(u.id) as id
  236 + FROM mc_visit u
  237 + WHERE 1=1
  238 + and not exists( select id from mc_visit_user t where t.user_phone=u.user_phone)
  239 + GROUP BY u.user_name, u.user_phone
  240 + ) tb on v.id= tb.id
  241 + WHERE 1=1
  242 + <if test="companyCode != null and companyCode != ''"> and v.company_code = #{companyCode}</if>
  243 + <if test="vlgOrCmty != null and vlgOrCmty != ''"> and v.vlg_or_cmty = #{vlgOrCmty}</if>
  244 + </select>
196 245 </mapper>
... ...