Browse Source

常住人口

shiqian 3 năm trước cách đây
mục cha
commit
4bee8a4b05

+ 5 - 5
boman-api/boman-domain/src/main/java/com/boman/domain/Czrk.java

@@ -5,13 +5,10 @@ import java.util.List;
 
 import com.boman.domain.annotation.Excel;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.*;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
 import lombok.experimental.SuperBuilder;
 
 /**
@@ -20,8 +17,8 @@ import lombok.experimental.SuperBuilder;
  * @author ruoyi
  * @date 2022-01-14
  */
+@EqualsAndHashCode(callSuper = true)
 @Data
-@SuperBuilder
 @NoArgsConstructor
 @AllArgsConstructor
 @ToString
@@ -222,6 +219,9 @@ public class Czrk extends BaseEntity {
     /** 部门id集合 */
     private List<Long> deptIdList;
 
+    /** 户籍地址查询展示 安徽省安庆市潜山市xx乡xx村xx组 */
+    private String nowInSelect;
+
     private java.sql.Timestamp createTime;
     private java.sql.Timestamp updateTime;
     private String createBy;

+ 38 - 19
boman-web-core/src/main/java/com/boman/web/core/controller/CzrkController.java

@@ -1,9 +1,5 @@
 package com.boman.web.core.controller;
 
-import java.io.IOException;
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
 import com.boman.common.core.utils.poi.ExcelUtil;
 import com.boman.common.core.web.controller.BaseController;
 import com.boman.common.log.annotation.Log;
@@ -13,14 +9,11 @@ import com.boman.domain.TableDataInfo;
 import com.boman.domain.dto.AjaxResult;
 import com.boman.web.core.service.czrk.ICzrkService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
 
 /**
  * 常住人口Controller
@@ -29,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
  * @date 2022-01-14
  */
 @RestController
-@RequestMapping("/czrk")
+@RequestMapping("/core/czrk1")
 public class CzrkController extends BaseController {
 
     @Autowired
@@ -41,8 +34,14 @@ public class CzrkController extends BaseController {
 //    @PreAuthorize("@ss.hasPermi('system:czrk:list')")
     @GetMapping("/list")
     public TableDataInfo list(Czrk czrk) {
-        startPage();
-        List<Czrk> list = czrkService.selectCzrkList(czrk);
+//        startPage();
+        List<Czrk> list = czrkService.listByRlry(czrk);
+        return getDataTable(list);
+    }
+
+    @GetMapping("/listByXz")
+    public TableDataInfo listByXz(Czrk czrk) {
+        List<Czrk> list = czrkService.listByXz(czrk);
         return getDataTable(list);
     }
 
@@ -88,12 +87,32 @@ public class CzrkController extends BaseController {
     }
 
     /**
-     * 删除常住人口
+     * 功能描述: 删除常住人口,人员认领中的删除也是这个接口
      */
 //    @PreAuthorize("@ss.hasPermi('system:czrk:remove')")
     @Log(title = "常住人口", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(czrkService.deleteCzrkByIds(ids));
+    @GetMapping("/{id}")
+    public AjaxResult deleteCzrk(@PathVariable("id") Long id) {
+        return toAjax(czrkService.deleteCzrk(id));
+    }
+
+    /**
+     * 功能描述: 回收站的还原功能
+     *
+     * @return com.boman.domain.dto.AjaxResult
+     */
+    @GetMapping("/reduction/{id}")
+    public AjaxResult reduction(@PathVariable("id") String id) {
+        return toAjax(czrkService.reduction(id));
+    }
+
+    /**
+     * 功能描述: 根据户号查找家庭中所有人员
+     *
+     * @return com.boman.domain.dto.AjaxResult
+     */
+    @GetMapping("/family/{code}")
+    public AjaxResult family(@PathVariable("code") String code) {
+        return AjaxResult.success(czrkService.family(code));
     }
 }

+ 15 - 1
boman-web-core/src/main/java/com/boman/web/core/mapper/CzrkMapper.java

@@ -1,6 +1,8 @@
 package com.boman.web.core.mapper;
 
 import com.boman.domain.Czrk;
+import com.boman.domain.VaccineInfoOperation;
+import org.checkerframework.checker.units.qual.C;
 
 import java.util.List;
 
@@ -52,11 +54,23 @@ public interface CzrkMapper {
      */
     int deleteCzrkById(Long id);
 
+    int reduction(String id);
+
     /**
      * 批量删除常住人口
      *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    int deleteCzrkByIds(Long[] ids);
+//    int deleteCzrk(Long[] ids);
+    int deleteCzrk(Czrk czrk);
+
+    List<Czrk> listByRlry(Czrk czrk);
+
+    List<Czrk> listByXz(Czrk czrk);
+    List<Czrk> listByJs(Czrk czrk);
+    int countByJs(Czrk czrk);
+    int countByXz(Czrk czrk);
+
+    List<Czrk> listByCode(String code);
 }

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/mapper/VaccineInfoMapper.java

@@ -42,7 +42,7 @@ public interface VaccineInfoMapper
     public List<VaccineInfoOperation> listByRlry(VaccineInfoOperation vaccineInfo);
 
 
-    public List<VaccineInfoOperation> selectVaccineInfoListByPage(int startNum, int endNum);
+    public List<VaccineInfoOperation> selectVaccineInfoListByPage(@Param("startNum") int startNum, @Param("endNum") int endNum);
 
 
     /**

+ 148 - 14
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java

@@ -1,23 +1,128 @@
 package com.boman.web.core.service.czrk;
 
+import com.boman.common.core.utils.StringUtils;
+import com.boman.common.core.utils.sql.SqlUtil;
+import com.boman.common.core.web.page.PageDomain;
+import com.boman.common.core.web.page.TableSupport;
 import com.boman.domain.Czrk;
+import com.boman.domain.SysDept;
+import com.boman.domain.SysRole;
+import com.boman.domain.VaccineInfoOperation;
+import com.boman.system.api.RemoteDeptService;
 import com.boman.web.core.mapper.CzrkMapper;
+import com.boman.web.core.utils.AuthUtils;
+import com.github.pagehelper.PageHelper;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.Collections;
 import java.util.List;
+import java.util.Map;
+
+import static com.boman.common.core.utils.StringUtils.isNotEmpty;
+import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
+import static com.boman.common.core.utils.obj.ObjectUtils.map;
 
 /**
  * 常住人口Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2022-01-14
  */
 @Service
-public class CzrkServiceImpl implements ICzrkService 
-{
+@Slf4j
+public class CzrkServiceImpl implements ICzrkService {
+
     @Autowired
     private CzrkMapper czrkMapper;
+    @Resource
+    private RemoteDeptService remoteDeptService;
+
+
+    @Override
+    public List<Czrk> listByRlry(Czrk czrk) {
+        setDeptIdList(czrk);
+        setAgeScope(czrk);
+        startPage();
+
+        List<Czrk> czrks = czrkMapper.listByRlry(czrk);
+        handleList(czrks);
+        return czrks;
+    }
+
+    @Override
+    public List<Czrk> listByXz(Czrk czrk) {
+        setDeptIdList(czrk);
+        List<Czrk> czrks = czrkMapper.listByXz(czrk);
+        handleList(czrks);
+        return czrks;
+    }
+
+    @Override
+    public List<Czrk> listByJs(Czrk czrk) {
+        setDeptIdList(czrk);
+        List<Czrk> czrks = czrkMapper.listByJs(czrk);
+        handleList(czrks);
+        return czrks;
+    }
+
+    private void handleList(List<Czrk> czrks) {
+        for (Czrk crk : czrks) {
+            // 現在居住地址查询展示 安徽省安庆市潜山市xx乡xx村xx组
+            String addr = crk.getProvince() + crk.getCity() + crk.getRegion() + crk.getVillageTowns() +
+                    crk.getVillage() + crk.getVillagerGroup() + crk.getNowIn();
+            crk.setNowInSelect(addr);
+        }
+    }
+
+    private void startPage() {
+        PageDomain pageDomain = TableSupport.buildPageRequest();
+        Integer pageNum = pageDomain.getPageNum();
+        Integer pageSize = pageDomain.getPageSize();
+        if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
+            String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
+            PageHelper.startPage(pageNum, pageSize, orderBy);
+        }
+    }
+
+    private void setAgeScope(Czrk czrk) {
+        Map<String, Object> params = czrk.getParams();
+        String ageScope = (String) params.get("age");
+        if (isNotEmpty(ageScope)) {
+            ageScope = ageScope.trim();
+            String[] split = ageScope.split("-");
+            params.put("startAge", Integer.parseInt(split[0]));
+            if (split.length == 2) {
+                params.put("endAge", Integer.parseInt(split[1]));
+            }
+        }
+    }
+
+    private void setDeptIdList(Czrk czrk) {
+        Long deptId = czrk.getDeptId();
+        if (deptId == null) {
+            deptId = AuthUtils.getLoginUser().getSysUser().getDeptId();
+            //判断是否是管理员
+            List<SysRole> roles = AuthUtils.getLoginUser().getSysUser().getRoles();
+            if (isNotEmpty(roles)) {
+                for (SysRole role : roles) {
+                    String roleKey = role.getRoleKey();
+                    if ("admin".equals(roleKey) || "city".equals(roleKey)) {
+                        return;
+                    }
+                }
+            }
+        }
+
+        if (deptId != null) {
+            List<SysDept> sysDepts = remoteDeptService.listChildrenDepts(deptId);
+            if (isNotEmpty(sysDepts)) {
+                czrk.setDeptIdList(map(sysDepts, SysDept::getId));
+            }
+        }
+    }
 
     /**
      * 查询常住人口
@@ -57,37 +162,66 @@ public class CzrkServiceImpl implements ICzrkService
 
     /**
      * 修改常住人口
-     * 
+     *
      * @param czrk 常住人口
      * @return 结果
      */
     @Override
-    public int updateCzrk(Czrk czrk)
-    {
+    public int updateCzrk(Czrk czrk) {
         return czrkMapper.updateCzrk(czrk);
     }
 
     /**
      * 批量删除常住人口
-     * 
-     * @param ids 需要删除的常住人口主键
+     *
+     * @param id 需要删除的常住人口主键
      * @return 结果
      */
     @Override
-    public int deleteCzrkByIds(Long[] ids)
-    {
-        return czrkMapper.deleteCzrkByIds(ids);
+    public int deleteCzrk(Long id) {
+        Czrk crk = new Czrk();
+        crk.setId(id);
+        crk.setUpdateBy(AuthUtils.getLoginUser().getSysUser().getUserName());
+        if (isEmpty(crk.getDeleteReason())) {
+            log.error("删除常住人口,删除原因不能为空, id={}", id);
+            return 0;
+        }
+
+        return czrkMapper.deleteCzrk(crk);
     }
 
     /**
      * 删除常住人口信息
-     * 
+     *
      * @param id 常住人口主键
      * @return 结果
      */
     @Override
-    public int deleteCzrkById(Long id)
-    {
+    public int deleteCzrkById(Long id) {
         return czrkMapper.deleteCzrkById(id);
     }
+
+    /**
+     * 功能描述: 回收站的还原功能
+     *
+     * @param id id
+     * @return int
+     */
+    @Override
+    public int reduction(String id) {
+        if (isEmpty(id)) return 0;
+
+        return czrkMapper.reduction(id);
+    }
+
+    @Override
+    public List<Czrk> family(String code) {
+        if (isEmpty(code)) {
+            return Collections.emptyList();
+        }
+
+        List<Czrk> czrks = czrkMapper.listByCode(code);
+        handleList(czrks);
+        return czrks;
+    }
 }

+ 13 - 1
boman-web-core/src/main/java/com/boman/web/core/service/czrk/ICzrkService.java

@@ -1,6 +1,8 @@
 package com.boman.web.core.service.czrk;
 
 import com.boman.domain.Czrk;
+import com.boman.domain.VaccineInfoOperation;
+import org.checkerframework.checker.units.qual.C;
 
 import java.util.List;
 
@@ -11,6 +13,12 @@ import java.util.List;
  * @date 2022-01-14
  */
 public interface ICzrkService {
+
+
+    List<Czrk> listByRlry(Czrk czrk);
+
+    List<Czrk> listByXz(Czrk czrk);
+    List<Czrk> listByJs(Czrk czrk);
     /**
      * 查询常住人口
      *
@@ -49,7 +57,7 @@ public interface ICzrkService {
      * @param ids 需要删除的常住人口主键集合
      * @return 结果
      */
-    int deleteCzrkByIds(Long[] ids);
+//    int deleteCzrkByIds(Long[] ids);
 
     /**
      * 删除常住人口信息
@@ -58,4 +66,8 @@ public interface ICzrkService {
      * @return 结果
      */
     int deleteCzrkById(Long id);
+
+    int deleteCzrk(Long id);
+    int reduction(String id);
+    List<Czrk> family(String code);
 }

+ 191 - 12
boman-web-core/src/main/resources/mapper/CzrkMapper.xml

@@ -42,13 +42,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectCzrkVo">
-        select id, user_name, gender, age, birthday, id_card, phone_num, code, house_type, rlr, rl_time, yhzgx, work_unit, province_id, province, city_id, city, region_id, region, village_towns_id, village_towns, village_id, village, villager_group_id, villager_group, now_in, remark, status, create_by, create_time, update_by, update_time, is_del, delete_reason from czrk
+        select id, user_name, gender, age, birthday, id_card, phone_num, code, house_type, rlr, rl_time, yhzgx
+             , work_unit, province_id, province, city_id, city, region_id, region, village_towns_id, village_towns
+             , village_id, village, villager_group_id, villager_group, now_in, remark, status, create_by, create_time
+             , update_by, update_time, is_del, delete_reason, dept_id, is_rl from czrk
     </sql>
 
-    <select id="selectCzrkList"  resultMap="CzrkResult">
-        <include refid="selectCzrkVo"/>
-        <where>  
-            <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
+    <select id="listByRlry"  resultMap="CzrkResult">
+        select id, user_name, phone_num, id_card, gender, province, city, region
+        , house_type, update_by, code, rlr, update_time, delete_reason, now_in
+        from czrk
+        <where>
+            <!-- 已认领 -->
+            <if test="isRl != null and isRl != ''">and is_rl = #{isRl}</if>
+
+            <if test="userName != null  and userName != ''">
+                and (user_name like concat('%', #{userName}, '%') or id_card like concat('%', #{userName}, '%'))
+            </if>
+            <if test="params.startAge != null  and params.startAge != ''">and age &gt;= #{params.startAge}</if>
+            <if test="params.endAge != null  and params.endAge != ''">and age &lt;= #{params.endAge}</if>
             <if test="gender != null  and gender != ''"> and gender = #{gender}</if>
             <if test="age != null "> and age = #{age}</if>
             <if test="birthday != null "> and birthday = #{birthday}</if>
@@ -76,9 +88,159 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null  and status != ''"> and status = #{status}</if>
             <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
             <if test="deleteReason != null  and deleteReason != ''"> and delete_reason = #{deleteReason}</if>
+            <if test="deptIdList != null and deptIdList.size() > 0">
+                and vi.dept_id in
+                <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                    #{deptId}
+                </foreach>
+            </if>
         </where>
+        order by create_time DESC
     </select>
-    
+
+    <select id="listByXz"  resultMap="CzrkResult">
+        select vi.id, vi.create_time, vi.update_time, vi.is_del, vi.update_by, vi.user_name, vi.phone_num, vi.id_card
+        , vi.gender, vi.province, vi.city, vi.region, vi.now_in, vi.house_type, vi.update_by, vi.code
+        from czrk vi
+        where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
+        <if test="userName != null  and userName != ''">
+            and (vi.user_name like concat('%', #{userName}, '%') or vi.id_card like concat('%', #{userName}, '%'))
+        </if>
+        <if test="villageTowns != null  and villageTowns != ''">
+            and vi.village_towns = #{villageTowns}
+        </if>
+        <if test="village != null  and village != ''"> and vi.village = #{village}</if>
+        <if test="villagerGroup != null  and villagerGroup != ''"> and vi.villager_group = #{villagerGroup}</if>
+        <if test="houseType != null  and houseType != ''"> and vi.house_type = #{houseType}</if>
+        <if test="province != null  and province != ''"> and vi.province = #{province}</if>
+        <if test="city != null  and city != ''"> and vi.city = #{city}</if>
+        <if test="region != null  and region != ''"> and vi.region = #{region}</if>
+        <if test="gender != null  and gender != ''"> and vi.gender = #{gender}</if>
+        <if test="idCard != null  and idCard != ''"> and vi.id_card like concat('%', #{idCard}, '%')</if>
+        <if test="phoneNum != null  and phoneNum != ''"> and vi.phone_num = #{phoneNum}</if>
+        <if test="params.startAge != null  and params.startAge != ''"> and vi.age &gt;= #{params.startAge}</if>
+        <if test="params.endAge != null  and params.endAge != ''"> and vi.age &lt;= #{params.endAge}</if>
+        <if test="status != null  and status != ''"> and vi.status = #{status}</if>
+        <if test="code != null  and code != ''"> and vi.code = #{code}</if>
+        <if test="birthday != null  and birthday != ''"> and vi.birthday = #{birthday}</if>
+        <if test="workUnit != null  and workUnit != ''"> and vi.work_unit = #{workUnit}</if>
+        <if test="nowIn != null  and nowIn != ''"> and vi.now_in = #{nowIn}</if>
+        <if test="deptIdList != null  and deptIdList.size() > 0">
+            and vi.dept_id in
+            <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="countByXz" resultType="int">
+        select count(1)
+        from czrk vi
+        where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
+        <if test="villageTowns != null  and villageTowns != ''">
+            and vi.village_towns = #{villageTowns}
+        </if>
+        <if test="village != null  and village != ''"> and vi.village = #{village}</if>
+        <if test="villagerGroup != null  and villagerGroup != ''"> and vi.villager_group = #{villagerGroup}</if>
+        <if test="houseType != null  and houseType != ''"> and vi.house_type = #{houseType}</if>
+        <if test="province != null  and province != ''"> and vi.province = #{province}</if>
+        <if test="city != null  and city != ''"> and vi.city = #{city}</if>
+        <if test="region != null  and region != ''"> and vi.region = #{region}</if>
+        <if test="userName != null  and userName != ''"> and vi.user_name like concat('%', #{userName}, '%')</if>
+        <if test="gender != null  and gender != ''"> and vi.gender = #{gender}</if>
+        <if test="idCard != null  and idCard != ''"> and vi.id_card like concat('%', #{idCard}, '%')</if>
+        <if test="phoneNum != null  and phoneNum != ''"> and vi.phone_num = #{phoneNum}</if>
+        <if test="params.startAge != null  and params.startAge != ''"> and vi.age &gt;= #{params.startAge}</if>
+        <if test="params.endAge != null  and params.endAge != ''"> and vi.age &lt;= #{params.endAge}</if>
+        <if test="status != null  and status != ''"> and vi.status = #{status}</if>
+        <if test="code != null  and code != ''"> and vi.code = #{code}</if>
+        <if test="birthday != null  and birthday != ''"> and vi.birthday = #{birthday}</if>
+        <if test="workUnit != null  and workUnit != ''"> and vi.work_unit = #{workUnit}</if>
+        <if test="nowIn != null  and nowIn != ''"> and vi.now_in = #{nowIn}</if>
+        <if test="deptIdList != null  and deptIdList.size() > 0">
+            and vi.dept_id in
+            <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="listByJs" resultMap="CzrkResult">
+        select vi.id, vi.create_time, vi.update_time, vi.is_del, vi.update_by, vi.user_name, vi.phone_num, vi.id_card
+        , vi.gender, vi.province, vi.city, vi.region, vi.now_in, vi.house_type, vi.update_by, vi.code
+        from czrk vi
+        where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
+        <if test="userName != null  and userName != ''">
+            and (vi.user_name like concat('%', #{userName}, '%') or vi.id_card like concat('%', #{userName}, '%'))
+        </if>
+        <if test="villageTowns != null  and villageTowns != ''">
+            and vi.village_towns = #{villageTowns}
+        </if>
+        <if test="village != null  and village != ''"> and vi.village = #{village}</if>
+        <if test="villagerGroup != null  and villagerGroup != ''"> and vi.villager_group = #{villagerGroup}</if>
+        <if test="houseType != null  and houseType != ''"> and vi.house_type = #{houseType}</if>
+        <if test="province != null  and province != ''"> and vi.province = #{province}</if>
+        <if test="city != null  and city != ''"> and vi.city = #{city}</if>
+        <if test="region != null  and region != ''"> and vi.region = #{region}</if>
+        <if test="userName != null  and userName != ''"> and vi.user_name like concat('%', #{userName}, '%')</if>
+        <if test="gender != null  and gender != ''"> and vi.gender = #{gender}</if>
+        <if test="idCard != null  and idCard != ''"> and vi.id_card like concat('%', #{idCard}, '%')</if>
+        <if test="phoneNum != null  and phoneNum != ''"> and vi.phone_num = #{phoneNum}</if>
+        <if test="params.startAge != null  and params.startAge != ''"> and vi.age &gt;= #{params.startAge}</if>
+        <if test="params.endAge != null  and params.endAge != ''"> and vi.age &lt;= #{params.endAge}</if>
+        <if test="status != null  and status != ''"> and vi.status = #{status}</if>
+        <if test="code != null  and code != ''"> and vi.code = #{code}</if>
+        <if test="birthday != null  and birthday != ''"> and vi.birthday = #{birthday}</if>
+        <if test="workUnit != null  and workUnit != ''"> and vi.work_unit = #{workUnit}</if>
+        <if test="nowIn != null  and nowIn != ''"> and vi.now_in = #{nowIn}</if>
+        <if test="deptIdList != null  and deptIdList.size() > 0">
+            and vi.dept_id in
+            <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="countByJs" resultType="int">
+        select count(1)
+        from vaccine_info vi
+        where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
+        <if test="villageTowns != null  and villageTowns != ''">
+            and vi.village_towns = #{villageTowns}
+        </if>
+        <if test="village != null  and village != ''"> and vi.village = #{village}</if>
+        <if test="villagerGroup != null  and villagerGroup != ''"> and vi.villager_group = #{villagerGroup}</if>
+        <if test="houseType != null  and houseType != ''"> and vi.house_type = #{houseType}</if>
+        <if test="province != null  and province != ''"> and vi.province = #{province}</if>
+        <if test="city != null  and city != ''"> and vi.city = #{city}</if>
+        <if test="region != null  and region != ''"> and vi.region = #{region}</if>
+        <if test="userName != null  and userName != ''"> and vi.user_name like concat('%', #{userName}, '%')</if>
+        <if test="gender != null  and gender != ''"> and vi.gender = #{gender}</if>
+        <if test="idCard != null  and idCard != ''"> and vi.id_card like concat('%', #{idCard}, '%')</if>
+        <if test="phoneNum != null  and phoneNum != ''"> and vi.phone_num = #{phoneNum}</if>
+        <if test="params.startAge != null  and params.startAge != ''"> and vi.age &gt;= #{params.startAge}</if>
+        <if test="params.endAge != null  and params.endAge != ''"> and vi.age &lt;= #{params.endAge}</if>
+        <if test="status != null  and status != ''"> and vi.status = #{status}</if>
+        <if test="code != null  and code != ''"> and vi.code = #{code}</if>
+        <if test="birthday != null  and birthday != ''"> and vi.birthday = #{birthday}</if>
+        <if test="workUnit != null  and workUnit != ''"> and vi.work_unit = #{workUnit}</if>
+        <if test="nowIn != null  and nowIn != ''"> and vi.now_in = #{nowIn}</if>
+        <if test="deptIdList != null  and deptIdList.size() > 0">
+            and vi.dept_id in
+            <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="listByCode" resultMap="CzrkResult">
+        select vi.id, vi.user_name, vi.phone_num, vi.id_card, vi.gender, vi.province, vi.city, vi.region, vi.now_in
+        , vi.house_type, vi.update_by, vi.code, vi.rlr, vi.yhzgx
+        from czrk vi
+        <!--把户主放第一位-->
+        where vi.is_del = 'N' and code = #{code} order by house_type desc;
+    </select>
+
     <select id="selectCzrkById" parameterType="Long" resultMap="CzrkResult">
         <include refid="selectCzrkVo"/>
         where id = #{id}
@@ -202,10 +364,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from czrk where id = #{id}
     </delete>
 
-    <delete id="deleteCzrkByIds" parameterType="String">
-        delete from czrk where id in 
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
+    <update id="reduction">
+        update czrk
+        set is_del        = 'N'
+          , update_by     = #{updateBy}
+          , update_time   = sysdate()
+        where id = #{id}
+    </update>
+
+<!--    <delete id="deleteCzrk" parameterType="String">-->
+<!--        delete from czrk where id in -->
+<!--        <foreach item="id" collection="array" open="(" separator="," close=")">-->
+<!--            #{id}-->
+<!--        </foreach>-->
+<!--    </delete>-->
+
+    <update id="deleteCzrk">
+        update czrk
+        set is_del        = 'Y'
+          , delete_reason = #{deleteReason}
+          , update_by     = #{updateBy}
+          , update_time   = sysdate()
+        where id = #{id}
+    </update>
 </mapper>

+ 1 - 1
boman-web-core/src/main/resources/mapper/VaccineInfoMapper.xml

@@ -394,7 +394,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="listByRlry" resultMap="VaccineInfoResult">
         select vi.id, vi.user_name, vi.phone_num, vi.id_card, vi.gender, vi.province, vi.city, vi.region, vi.now_in
-               , vi.house_type, vi.update_by, vi.code, vi.rlr, vi.update_time, vi.delete_reason, vi.domicile, vi.now_in
+               , vi.house_type, vi.update_by, vi.code, vi.rlr, vi.update_time, vi.delete_reason, vi.domicile
         from vaccine_info vi
         <where>
             vi.is_del = #{isDel}