@ -4,129 +4,194 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace= "com.zdxt.code.mapper.EnforcementRegistrationMapper" >
<resultMap type= "EnforcementRegistration" id= "EnforcementRegistrationResult" >
<resultMap type= "com.zdxt.code.domain. EnforcementRegistration" id= "EnforcementRegistrationResult" >
<result property= "id" column= "id" />
<result property= "lawEnforcementIncident" column= "law_enforcement_incident" />
<result property= "lawEnforcementContent" column= "law_enforcement_content" />
<result property= "lawEnforcement" column= "law_enforcement" />
<result property= "lawEnforcementId" column= "law_enforcement_id" />
<result property= "enterpriseId" column= "enterprise_id" />
<result property= "enterpriseName" column= "enterprise_name" />
<result property= "enterpriseNumber" column= "enterprise_number" />
<result property= "enforcementTime" column= "enforcement_time" />
<result property= "createTime" column= "create_time" />
<result property= "createBy" column= "create_by" />
<result property= "lawEnforcer" column= "law_enforcer" />
<result property= "lawEnforcerId" column= "law_enforcer_id" />
<result property= "lawEnforcerTel" column= "law_enforcer_tel" />
<result property= "createTime" column= "create_time" />
<result property= "lawEnforcerTwo" column= "law_enforcer_two" />
<result property= "lawEnforcerIdTwo" column= "law_enforcer_id_two" />
<result property= "lawEnforcerTelTwo" column= "law_enforcer_tel_two" />
<result property= "subsidiaryer" column= "subsidiaryer" />
<result property= "subsidiaryerId" column= "subsidiaryer_id" />
<result property= "subsidiaryerTel" column= "subsidiaryer_tel" />
<result property= "lawEnforcementItem" column= "law_enforcement_item" />
<result property= "lawEnforcementBasis" column= "law_enforcement_basis" />
<result property= "remark" column= "remark" />
<result property= "reslut" column= "reslut" />
<result property= "userId" column= "user_id" />
<result property= "deptId" column= "dept_id" />
<result property= "isDelete" column= "is_delete" />
<result property= "status" column= "status" />
<result property= "enterpriseNumber" column= "enterprise_number" />
<result property= "remark" column= "remark" />
<result property= "isComplaint" column= "is_complaint" />
<result property= "lawEnforcementCode" column= "law_enforcement_code" />
</resultMap>
<resultMap type= "com.zdxt.code.domain.EnforceRegCount" id= "EnforceRegCountResult" >
<result property= "num" column= "num" />
<result property= "lawEnforcement" column= "law_enforcement" />
<result property= "lawEnforcementId" column= "law_enforcement_id" />
</resultMap>
<sql id= "selectEnforcementRegistrationVo" >
select id, law_enforcement_incident, law_enforcement_content, law_enforcement, law_enforcement_id, law_enforcer, law_enforcer_id, law_enforcer_tel, create_time, user_id, dept_id,is_delete, status,enterprise_number,remark,is_complaint from enforcement_registration
select id, law_enforcement, law_enforcement_id, enterprise_id, enterprise_name, enterprise_number, enforcement_time, create_time, create_by, law_enforcer, law_enforcer_id, law_enforcer_tel, law_enforcer_two, law_enforcer_id_two, law_enforcer_tel_two, subsidiaryer, subsidiaryer_id, subsidiaryer_tel, law_enforcement_item, law_enforcement_basis, remark, reslut, user_id, dept_id, is_delete, status, law_enforcement_code from enforcement_registration
</sql>
<select id= "selectEnforcementRegistrationList" parameterType= "EnforcementRegistration" resultMap= "EnforcementRegistrationResult" >
<include refid= "selectEnforcementRegistrationVo" />
<where >
<if test= "lawEnforcementIncident != null and lawEnforcementIncident != ''" > and law_enforcement_incident like concat('%', #{lawEnforcementIncident}, '%')</if>
<if test= "lawEnforcementContent != null and lawEnforcementContent != ''" > and law_enforcement_content = #{lawEnforcementContent}</if>
<if test= "lawEnforcement != null and lawEnforcement != ''" > and law_enforcement like concat('%', #{lawEnforcement}, '%')</if>
<if test= "lawEnforcement != null and lawEnforcement != ''" > and law_enforcement = #{lawEnforcement}</if>
<if test= "lawEnforcementId != null and lawEnforcementId != ''" > and law_enforcement_id = #{lawEnforcementId}</if>
<if test= "lawEnforcer != null and lawEnforcer != ''" > and law_enforcer like concat('%', #{lawEnforcer}, '%')</if>
<if test= "lawEnforcerId != null " > and law_enforcer_id = #{lawEnforcerId}</if>
<if test= "lawEnforcerTel != null and lawEnforcerTel != ''" > and law_enforcer_tel = #{lawEnforcerTel}</if>
<if test= "enterpriseId != null and enterpriseId != ''" > and enterprise_id = #{enterpriseId}</if>
<if test= "enterpriseName != null and enterpriseName != ''" > and enterprise_name like concat('%', #{enterpriseName}, '%')</if>
<if test= "enterpriseNumber != null and enterpriseNumber != ''" > and enterprise_number = #{enterpriseNumber}</if>
<if test= "enforcementTime != null " > and enforcement_time = #{enforcementTime}</if>
<if test= "lawEnforcer != null and lawEnforcer != ''" > and law_enforcer = #{lawEnforcer}</if>
<if test= "lawEnforcerId != null and lawEnforcerId != ''" > and law_enforcer_id = #{lawEnforcerId}</if>
<if test= "lawEnforcerTel != null and lawEnforcerTel != ''" > and law_enforcer_tel = #{lawEnforcerTel}</if>
<if test= "lawEnforcerTwo != null and lawEnforcerTwo != ''" > and law_enforcer_two = #{lawEnforcerTwo}</if>
<if test= "lawEnforcerIdTwo != null and lawEnforcerIdTwo != ''" > and law_enforcer_id_two = #{lawEnforcerIdTwo}</if>
<if test= "lawEnforcerTelTwo != null and lawEnforcerTelTwo != ''" > and law_enforcer_tel_two = #{lawEnforcerTelTwo}</if>
<if test= "subsidiaryer != null and subsidiaryer != ''" > and subsidiaryer = #{subsidiaryer}</if>
<if test= "subsidiaryerId != null and subsidiaryerId != ''" > and subsidiaryer_id = #{subsidiaryerId}</if>
<if test= "subsidiaryerTel != null and subsidiaryerTel != ''" > and subsidiaryer_tel = #{subsidiaryerTel}</if>
<if test= "lawEnforcementItem != null and lawEnforcementItem != ''" > and law_enforcement_item = #{lawEnforcementItem}</if>
<if test= "lawEnforcementBasis != null and lawEnforcementBasis != ''" > and law_enforcement_basis = #{lawEnforcementBasis}</if>
<if test= "reslut != null " > and reslut = #{reslut}</if>
<if test= "userId != null " > and user_id = #{userId}</if>
<if test= "deptId != null " > and dept_id = #{deptId}</if>
<if test= "isDelete != null " > and is_delete = #{isDelete}</if>
<if test= "status != null " > and status = #{status}</if>
<if test= "isComplaint != null " > and is_complaint = #{isComplaint}</if>
<if test= "dateType == 1" >
and YEAR(create_time) = YEAR(CURDATE())
<if test= "lawEnforcementCode != null and lawEnforcementCode != ''" > and law_enforcement_code = #{lawEnforcementCode}</if>
<if test= "searchValue != null and searchValue != ''" >
and ( enterprise_name like concat(concat('%',#{searchValue}),'%')
or law_enforcement_code like concat(concat('%',#{searchValue}),'%')
or law_enforcer_tel like concat(concat('%',#{searchValue}),'%')
)
</if>
<if test= "dateType != null and dateType == 1" >
and DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
</if>
<if test= "dateType == 2" >
and DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(NOW(), '%Y-%m')
<if test= "dateType != null and dateType == 2" >
and create_time >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH )
</if>
<if test= "searchText != null and searchText != ''" >
or law_enforcement_incident like concat('%', #{searchText}, '%')
or law_enforcement like concat('%', #{searchText}, '%')
or law_enforcer like concat('%', #{searchText}, '%')
<if test= "dateType != null and dateType == 3" >
and create_time >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
</if>
and is_delete = 0
</where>
order by create_time desc
</select>
<select id= "selectEnforcementRegistrationById" parameterType= "String" resultMap= "EnforcementRegistrationResult" >
<include refid= "selectEnforcementRegistrationVo" />
where id = #{id} and is_delete = 0
where id = #{id}
</select>
<insert id= "insertEnforcementRegistration" parameterType= "EnforcementRegistration" >
insert into enforcement_registration
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "id != null and id != ''" > id,</if>
<if test= "lawEnforcementIncident != null and lawEnforcementIncident != ''" > law_enforcement_incident,</if>
<if test= "lawEnforcementContent != null and lawEnforcementContent != ''" > law_enforcement_content,</if>
<if test= "lawEnforcement != null and lawEnforcement != ''" > law_enforcement,</if>
<if test= "lawEnforcementId != null and lawEnforcementId != ''" > law_enforcement_id,</if>
<if test= "lawEnforcer != null and lawEnforcer != ''" > law_enforcer,</if>
<if test= "lawEnforcerId != null " > law_enforcer_id,</if>
<if test= "lawEnforcerTel != null and lawEnforcerTel != ''" > law_enforcer_tel,</if>
<if test= "enterpriseId != null and enterpriseId != ''" > enterprise_id,</if>
<if test= "enterpriseName != null and enterpriseName != ''" > enterprise_name,</if>
<if test= "enterpriseNumber != null and enterpriseNumber != ''" > enterprise_number,</if>
<if test= "enforcementTime != null " > enforcement_time,</if>
<if test= "createTime != null " > create_time,</if>
<if test= "createBy != null and createBy != ''" > create_by,</if>
<if test= "lawEnforcer != null and lawEnforcer != ''" > law_enforcer,</if>
<if test= "lawEnforcerId != null and lawEnforcerId != ''" > law_enforcer_id,</if>
<if test= "lawEnforcerTel != null and lawEnforcerTel != ''" > law_enforcer_tel,</if>
<if test= "lawEnforcerTwo != null and lawEnforcerTwo != ''" > law_enforcer_two,</if>
<if test= "lawEnforcerIdTwo != null and lawEnforcerIdTwo != ''" > law_enforcer_id_two,</if>
<if test= "lawEnforcerTelTwo != null and lawEnforcerTelTwo != ''" > law_enforcer_tel_two,</if>
<if test= "subsidiaryer != null and subsidiaryer != ''" > subsidiaryer,</if>
<if test= "subsidiaryerId != null and subsidiaryerId != ''" > subsidiaryer_id,</if>
<if test= "subsidiaryerTel != null and subsidiaryerTel != ''" > subsidiaryer_tel,</if>
<if test= "lawEnforcementItem != null and lawEnforcementItem != ''" > law_enforcement_item,</if>
<if test= "lawEnforcementBasis != null and lawEnforcementBasis != ''" > law_enforcement_basis,</if>
<if test= "remark != null and remark != ''" > remark,</if>
<if test= "reslut != null " > reslut,</if>
<if test= "userId != null " > user_id,</if>
<if test= "deptId != null " > dept_id,</if>
<if test= "status != null " > status,</if>
<if test= "isDelete != null " > is_delete,</if>
<if test= "remark != null and remark != '' " > remark,</if>
<if test= "isComplaint != null" > is_complaint,</if>
<if test= "status != null " > status ,</if>
<if test= "lawEnforcementCode != null and lawEnforcementCode != ''" > law_enforcement_code ,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "id != null and id != ''" > #{id},</if>
<if test= "lawEnforcementIncident != null and lawEnforcementIncident != ''" > #{lawEnforcementIncident},</if>
<if test= "lawEnforcementContent != null and lawEnforcementContent != ''" > #{lawEnforcementContent},</if>
<if test= "lawEnforcement != null and lawEnforcement != ''" > #{lawEnforcement},</if>
<if test= "lawEnforcementId != null and lawEnforcementId != ''" > #{lawEnforcementId},</if>
<if test= "lawEnforcer != null and lawEnforcer != ''" > #{lawEnforcer},</if>
<if test= "lawEnforcerId != null " > #{lawEnforcerId},</if>
<if test= "lawEnforcerTel != null and lawEnforcerTel != ''" > #{lawEnforcerTel},</if>
<if test= "enterpriseId != null and enterpriseId != ''" > #{enterpriseId},</if>
<if test= "enterpriseName != null and enterpriseName != ''" > #{enterpriseName},</if>
<if test= "enterpriseNumber != null and enterpriseNumber != ''" > #{enterpriseNumber},</if>
<if test= "enforcementTime != null " > #{enforcementTime},</if>
<if test= "createTime != null " > #{createTime},</if>
<if test= "createBy != null and createBy != ''" > #{createBy},</if>
<if test= "lawEnforcer != null and lawEnforcer != ''" > #{lawEnforcer},</if>
<if test= "lawEnforcerId != null and lawEnforcerId != ''" > #{lawEnforcerId},</if>
<if test= "lawEnforcerTel != null and lawEnforcerTel != ''" > #{lawEnforcerTel},</if>
<if test= "lawEnforcerTwo != null and lawEnforcerTwo != ''" > #{lawEnforcerTwo},</if>
<if test= "lawEnforcerIdTwo != null and lawEnforcerIdTwo != ''" > #{lawEnforcerIdTwo},</if>
<if test= "lawEnforcerTelTwo != null and lawEnforcerTelTwo != ''" > #{lawEnforcerTelTwo},</if>
<if test= "subsidiaryer != null and subsidiaryer != ''" > #{subsidiaryer},</if>
<if test= "subsidiaryerId != null and subsidiaryerId != ''" > #{subsidiaryerId},</if>
<if test= "subsidiaryerTel != null and subsidiaryerTel != ''" > #{subsidiaryerTel},</if>
<if test= "lawEnforcementItem != null and lawEnforcementItem != ''" > #{lawEnforcementItem},</if>
<if test= "lawEnforcementBasis != null and lawEnforcementBasis != ''" > #{lawEnforcementBasis},</if>
<if test= "remark != null and remark != ''" > #{remark},</if>
<if test= "reslut != null " > #{reslut},</if>
<if test= "userId != null " > #{userId},</if>
<if test= "deptId != null " > #{deptId},</if>
<if test= "status != null " > #{status},</if>
<if test= "isDelete != null " > #{isDelete},</if>
<if test= "remark != null and remark != '' " > #{remark},</if>
<if test= "isComplaint != null" > #{isComplaint},</if>
<if test= "isDelete != null " > #{isDelete},</if>
<if test= "status != null " > #{status},</if>
<if test= "lawEnforcementCode != null and lawEnforcementCode != ''" > #{lawEnforcementCode},</if>
</trim>
</insert>
<update id= "updateEnforcementRegistration" parameterType= "EnforcementRegistration" >
update enforcement_registration
<trim prefix= "SET" suffixOverrides= "," >
<if test= "lawEnforcementIncident != null and lawEnforcementIncident != ''" > law_enforcement_incident = #{lawEnforcementIncident},</if>
<if test= "lawEnforcementContent != null and lawEnforcementContent != ''" > law_enforcement_content = #{lawEnforcementContent},</if>
<if test= "lawEnforcement != null and lawEnforcement != ''" > law_enforcement = #{lawEnforcement},</if>
<if test= "lawEnforcementId != null and lawEnforcementId != ''" > law_enforcement_id = #{lawEnforcementId},</if>
<if test= "enterpriseId != null and enterpriseId != ''" > enterprise_id = #{enterpriseId},</if>
<if test= "enterpriseName != null and enterpriseName != ''" > enterprise_name = #{enterpriseName},</if>
<if test= "enterpriseNumber != null and enterpriseNumber != ''" > enterprise_number = #{enterpriseNumber},</if>
<if test= "enforcementTime != null " > enforcement_time = #{enforcementTime},</if>
<if test= "createTime != null " > create_time = #{createTime},</if>
<if test= "createBy != null and createBy != ''" > create_by = #{createBy},</if>
<if test= "lawEnforcer != null and lawEnforcer != ''" > law_enforcer = #{lawEnforcer},</if>
<if test= "lawEnforcerId != null " > law_enforcer_id = #{lawEnforcerId},</if>
<if test= "lawEnforcerId != null and lawEnforcerId != '' " > law_enforcer_id = #{lawEnforcerId},</if>
<if test= "lawEnforcerTel != null and lawEnforcerTel != ''" > law_enforcer_tel = #{lawEnforcerTel},</if>
<if test= "createTime != null " > create_time = #{createTime},</if>
<if test= "lawEnforcerTwo != null and lawEnforcerTwo != ''" > law_enforcer_two = #{lawEnforcerTwo},</if>
<if test= "lawEnforcerIdTwo != null and lawEnforcerIdTwo != ''" > law_enforcer_id_two = #{lawEnforcerIdTwo},</if>
<if test= "lawEnforcerTelTwo != null and lawEnforcerTelTwo != ''" > law_enforcer_tel_two = #{lawEnforcerTelTwo},</if>
<if test= "subsidiaryer != null and subsidiaryer != ''" > subsidiaryer = #{subsidiaryer},</if>
<if test= "subsidiaryerId != null and subsidiaryerId != ''" > subsidiaryer_id = #{subsidiaryerId},</if>
<if test= "subsidiaryerTel != null and subsidiaryerTel != ''" > subsidiaryer_tel = #{subsidiaryerTel},</if>
<if test= "lawEnforcementItem != null and lawEnforcementItem != ''" > law_enforcement_item = #{lawEnforcementItem},</if>
<if test= "lawEnforcementBasis != null and lawEnforcementBasis != ''" > law_enforcement_basis = #{lawEnforcementBasis},</if>
<if test= "remark != null and remark != ''" > remark = #{remark},</if>
<if test= "reslut != null " > reslut = #{reslut},</if>
<if test= "userId != null " > user_id = #{userId},</if>
<if test= "deptId != null " > dept_id = #{deptId},</if>
<if test= "status != null " > status = #{status},</if>
<if test= "isDelete != null " > is_delete = #{isDelete},</if>
<if test= "enterpriseNumber != null and enterpriseNumber != ''" > enterprise_number = #{enterpriseNumber},</if>
<if test= "remark != null and remark != ''" > remark = #{remark},</if>
<if test= "isComplaint != null" > is_complaint = #{isComplaint},</if>
<if test= "isDelete != null " > is_delete = #{isDelete},</if>
<if test= "status != null " > status = #{status},</if>
<if test= "lawEnforcementCode != null and lawEnforcementCode != ''" > law_enforcement_code = #{lawEnforcementCode},</if>
</trim>
where id = #{id}
</update>
<upda te id= "deleteEnforcementRegistrationById" parameterType= "String" >
update enforcement_registration set is_delete = 1 where id = #{id}
</upda te>
<dele te id= "deleteEnforcementRegistrationById" parameterType= "String" >
delete from enforcement_registration where id = #{id}
</dele te>
<delete id= "deleteEnforcementRegistrationByIds" parameterType= "String" >
delete from enforcement_registration where id in
@ -135,5 +200,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id= "countMentByTime" resultMap= "EnforceRegCountResult"
resultType="com.zdxt.code.domain.EnforceRegCount">
SELECT law_enforcement, law_enforcement_id, COUNT(law_enforcement_id) AS num
FROM enforcement_registration
WHERE create_time >= DATE_SUB(CURDATE(), INTERVAL #{timeMonth} MONTH)
<if test= "searchValue != null and searchValue != ''" > AND law_enforcement like concat(concat('%',#{searchValue}),'%')</if>
AND law_enforcement_id IS NOT NULL
GROUP BY law_enforcement_id
</select>
</mapper>