浏览代码

人员认领 删除功能,重复的身份证给错误提示

shiqian 3 年之前
父节点
当前提交
c2f49ee403

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/controller/RyrlController.java

@@ -24,7 +24,7 @@ public class RyrlController extends BaseController {
     private IVaccineInfoService vaccineInfoService;
 
     /**
-     * 功能描述: 认领人员list, 如果isDel="Y", 则为回收站的功能,默认是isDel="N"
+     * 功能描述: 认领人员list, 如果isDel="Y", 则为回收站的功能,默认是isDelr="N"
      *
      * @param vaccineInfo vaccineInfo
      * @return com.boman.domain.TableDataInfo

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

@@ -121,6 +121,7 @@ public interface VaccineInfoMapper
      * @return int
      */
     int countCzrk(VaccineInfoOperation condition);
+    int countIdCard(String idCard);
 
     List<VaccineInfoOperation> listByCode(String code);
 }

+ 5 - 0
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/impl/VaccineInfoServiceImpl.java

@@ -1120,6 +1120,11 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
             vaccineInfo.setRlr(SecurityUtils.getUsername());
         }
 
+        int count = vaccineInfoMapper.countIdCard(vaccineInfo.getIdCard());
+        if (count > 0) {
+            return  AjaxResult.error(String.format("该人员[%s]已存在,请勿重复添加", vaccineInfo.getIdCard()));
+        }
+
         int i = vaccineInfoMapper.insertVaccineInfo(vaccineInfo);
         return i > 0 ? AjaxResult.success() : AjaxResult.error();
     }

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

@@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="progress"    column="progress"    />
         <result property="deptId"    column="dept_id"    />
         <result property="rlr"    column="rlr"    />
+        <result property="deleteReason"    column="delete_reason"    />
         <collection  property="vaccineInfoUserList"   javaType="java.util.List"        resultMap="VaccineInfoUser" />
     </resultMap>
 
@@ -378,6 +379,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
     </select>
 
+    <select id="countIdCard" resultType="int">
+        select count(vi.id) from vaccine_info vi where vi.is_del = 'N' and id_card = #{idCard}
+    </select>
+
     <select id="listByCode" 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
@@ -387,7 +392,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.house_type, vi.update_by, vi.code, vi.rlr, vi.update_time, vi.delete_reason
         from vaccine_info vi
         <where>
             vi.is_del = #{isDel}
@@ -640,7 +645,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
-            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="updateTime != null">update_time = sysdate(),</if>
             <if test="isDel != null and isDel != ''">is_del = #{isDel},</if>
             <if test="code != null and code != ''">code = #{code},</if>
             <if test="birthday != null and birthday != ''">birthday = #{birthday},</if>
@@ -655,6 +660,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="age != null and age != ''">age = #{age},</if>
             <if test="deptId != null">dept_id = #{deptId},</if>
             <if test="rlr != null and rlr != ''">rlr = #{rlr},</if>
+            <if test="deleteReason != null and deleteReason != ''">delete_reason = #{deleteReason},</if>
         </trim>
         where id = #{id}
     </update>