市北互联平台后端仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
3.0 KiB

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.IcNatDao">
<select id="getMyNatList" resultType="com.epmet.dto.result.MyNatListResultDTO">
SELECT
id icNatId,
user_id userId,
user_type userType,
`name` `name`,
mobile mobile,
id_card idCard,
nat_time natTime,
nat_result natResult,
nat_address natAddress,
file_name fileName,
attachment_url attachmentUrl
FROM
ic_nat
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND id_card = #{idCard}
ORDER BY nat_time DESC
</select>
<select id="getNatList" resultType="com.epmet.dto.result.NatListResultDTO">
SELECT
id icNatId,
agency_id agencyId,
user_id userId,
user_type userType,
`name` `name`,
mobile mobile,
id_card idCard,
nat_time natTime,
nat_result natResult,
nat_address natAddress
FROM
ic_nat
WHERE
del_flag = '0'
AND customer_id = #{customerId}
<if test='null != agencyId and "" != agencyId'>
AND (agency_id = #{agencyId} OR pids like concat('%', #{agencyId}, '%'))
</if>
<if test='null != name and "" != name'>
AND name like concat('%', #{name}, '%')
</if>
<if test='null != mobile and "" != mobile'>
AND mobile = #{mobile}
</if>
<if test='null != idCard and "" != idCard'>
AND id_card = #{idCard}
</if>
<if test='null != startTime and "" != startTime'>
AND nat_time <![CDATA[ >= ]]> #{startTime}
</if>
<if test='null != endTime and "" != endTime'>
AND nat_time <![CDATA[ <= ]]> #{endTime}
</if>
ORDER BY nat_time DESC
</select>
<delete id="delById">
DELETE FROM ic_nat WHERE id = #{icNatId}
</delete>
<insert id="insertOrUpdate">
INSERT INTO epmet_user.ic_nat
(ID, CUSTOMER_ID, AGENCY_ID, PIDS, USER_ID,
USER_TYPE, NAME, MOBILE, ID_CARD, NAT_TIME, NAT_RESULT, NAT_ADDRESS, FILE_NAME, ATTACHMENT_TYPE, ATTACHMENT_URL,
DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME)
VALUES (#{id}, #{customerId}, #{agencyId}, #{pids}, #{userId},
#{userType}, #{name}, #{mobile}, #{idCard}, #{natTime},
#{natResult}, #{natAddress}, #{fileName}, #{attachmentType}, #{attachmentUrl},
#{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy},
#{updatedTime})
ON DUPLICATE KEY update
NAME=#{name},
MOBILE=#{mobile},
NAT_ADDRESS=#{natAddress},
NAT_RESULT=#{natResult},
UPDATED_BY=#{updatedBy},
UPDATED_TIME=NOW()
</insert>
</mapper>