503 lines
16 KiB
XML
503 lines
16 KiB
XML
|
<?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.zhwl.user.mapper.ZdyUserTouristMapper">
|
||
|
|
||
|
<resultMap type="ZdyUserTourist" id="ZdyUserTouristResult">
|
||
|
<result property="id" column="id"/>
|
||
|
<result property="userId" column="user_id"/>
|
||
|
<result property="name" column="name"/>
|
||
|
<result property="mobile" column="mobile"/>
|
||
|
<result property="image" column="image"/>
|
||
|
<result property="status" column="status"/>
|
||
|
<result property="idCard" column="id_card"/>
|
||
|
<result property="createTime" column="create_time"/>
|
||
|
<result property="createBy" column="create_by"/>
|
||
|
<result property="updateTime" column="update_time"/>
|
||
|
<result property="updateBy" column="update_by"/>
|
||
|
<result property="remark" column="remark"/>
|
||
|
<result property="userName" column="userName"/>
|
||
|
<result property="userAvatar" column="userAvatar"/>
|
||
|
<result property="userMobile" column="userMobile"/>
|
||
|
<result property="bornDay" column="born_day"/>
|
||
|
<result property="certAddress" column="cert_address"/>
|
||
|
<result property="certNumber" column="cert_number"/>
|
||
|
<result property="certOrg" column="cert_org"/>
|
||
|
<result property="certType" column="cert_type"/>
|
||
|
<result property="effDate" column="eff_date"/>
|
||
|
<result property="expDate" column="exp_date"/>
|
||
|
<result property="gender" column="gender"/>
|
||
|
<result property="identityPic" column="identity_pic"/>
|
||
|
<result property="nation" column="nation"/>
|
||
|
<result property="partyName" column="party_name"/>
|
||
|
<result property="nationCode" column="nation_code"/>
|
||
|
<result property="faceId" column="face_id"/>
|
||
|
<result property="faceGroupId" column="face_group_id"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<sql id="selectZdyUserTouristVo">
|
||
|
SELECT tou.id,
|
||
|
tou.user_id,
|
||
|
tou.NAME,
|
||
|
tou.mobile,
|
||
|
tou.image,
|
||
|
tou.STATUS,
|
||
|
tou.id_card,
|
||
|
tou.create_time,
|
||
|
tou.create_by,
|
||
|
tou.update_time,
|
||
|
tou.update_by,
|
||
|
tou.remark,
|
||
|
CASE
|
||
|
WHEN (u.`name` IS NOT NULL AND u.`name` != '') THEN
|
||
|
u.`name`
|
||
|
ELSE u.nickname
|
||
|
END AS userName,
|
||
|
u.avatar as userAvatar,
|
||
|
u.mobile as userMobile,
|
||
|
tou.born_day,
|
||
|
tou.cert_address,
|
||
|
tou.cert_number,
|
||
|
tou.cert_org,
|
||
|
tou.cert_type,
|
||
|
tou.eff_date,
|
||
|
tou.exp_date,
|
||
|
tou.gender,
|
||
|
tou.identity_pic,
|
||
|
tou.nation,
|
||
|
tou.party_name,
|
||
|
tou.nation_code,
|
||
|
tou.face_id,
|
||
|
tou.face_group_id
|
||
|
FROM zdy_user_tourist tou
|
||
|
LEFT JOIN zdy_user u ON u.id = tou.user_id
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectZdyUserTouristList" parameterType="ZdyUserTourist" resultMap="ZdyUserTouristResult">
|
||
|
<include refid="selectZdyUserTouristVo"/>
|
||
|
<where>
|
||
|
<if test="userId != null ">
|
||
|
and tou.user_id = #{userId}
|
||
|
</if>
|
||
|
<if test="name != null and name != ''">
|
||
|
and tou.name like concat('%', #{name}, '%')
|
||
|
</if>
|
||
|
<if test="mobile != null and mobile != ''">
|
||
|
and tou.mobile = #{mobile}
|
||
|
</if>
|
||
|
<if test="status != null ">
|
||
|
and tou.status = #{status}
|
||
|
</if>
|
||
|
<if test="idCard != null and idCard != ''">
|
||
|
and tou.id_card = #{idCard}
|
||
|
</if>
|
||
|
<if test="faceId !=null">
|
||
|
and tou.face_id = #{faceId}
|
||
|
</if>
|
||
|
</where>
|
||
|
order by tou.id desc
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyUserTouristById" parameterType="Long"
|
||
|
resultMap="ZdyUserTouristResult">
|
||
|
<include refid="selectZdyUserTouristVo"/>
|
||
|
where tou.id = #{id}
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyUserTouristByIds" resultMap="ZdyUserTouristResult">
|
||
|
SELECT tou.id,
|
||
|
tou.user_id,
|
||
|
tou.NAME,
|
||
|
tou.mobile,
|
||
|
tou.image,
|
||
|
tou.STATUS,
|
||
|
tou.id_card,
|
||
|
tou.create_time,
|
||
|
tou.create_by,
|
||
|
tou.update_time,
|
||
|
tou.update_by,
|
||
|
tou.remark,
|
||
|
tou.born_day,
|
||
|
tou.cert_address,
|
||
|
tou.cert_number,
|
||
|
tou.cert_org,
|
||
|
tou.cert_type,
|
||
|
tou.eff_date,
|
||
|
tou.exp_date,
|
||
|
tou.gender,
|
||
|
tou.identity_pic,
|
||
|
tou.nation,
|
||
|
tou.party_name,
|
||
|
tou.nation_code,
|
||
|
tou.face_id,
|
||
|
tou.face_group_id
|
||
|
FROM zdy_user_tourist tou
|
||
|
where tou.id in
|
||
|
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</select>
|
||
|
|
||
|
<insert id="insertZdyUserTourist" parameterType="ZdyUserTourist" useGeneratedKeys="true"
|
||
|
keyProperty="id">
|
||
|
insert into zdy_user_tourist
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="userId != null">user_id,
|
||
|
</if>
|
||
|
<if test="name != null">name,
|
||
|
</if>
|
||
|
<if test="mobile != null">mobile,
|
||
|
</if>
|
||
|
<if test="image != null">image,
|
||
|
</if>
|
||
|
<if test="status != null">status,
|
||
|
</if>
|
||
|
<if test="idCard != null">id_card,
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time,
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by,
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time,
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by,
|
||
|
</if>
|
||
|
<if test="remark != null">remark,
|
||
|
</if>
|
||
|
<if test="bornDay != null">born_day,
|
||
|
</if>
|
||
|
<if test="certAddress != null">cert_address,
|
||
|
</if>
|
||
|
<if test="certNumber != null">cert_number,
|
||
|
</if>
|
||
|
<if test="certOrg != null">cert_org,
|
||
|
</if>
|
||
|
<if test="certType != null">cert_type,
|
||
|
</if>
|
||
|
<if test="effDate != null">eff_date,
|
||
|
</if>
|
||
|
<if test="expDate != null">exp_date,
|
||
|
</if>
|
||
|
<if test="gender != null">gender,
|
||
|
</if>
|
||
|
<if test="identityPic != null">identity_pic,
|
||
|
</if>
|
||
|
<if test="nation != null">nation,
|
||
|
</if>
|
||
|
<if test="partyName != null">party_name,
|
||
|
</if>
|
||
|
<if test="nationCode != null">nation_code,
|
||
|
</if>
|
||
|
<if test="faceId != null">face_id,
|
||
|
</if>
|
||
|
<if test="faceGroupId != null">face_group_id,
|
||
|
</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="userId != null">#{userId},
|
||
|
</if>
|
||
|
<if test="name != null">#{name},
|
||
|
</if>
|
||
|
<if test="mobile != null">#{mobile},
|
||
|
</if>
|
||
|
<if test="image != null">#{image},
|
||
|
</if>
|
||
|
<if test="status != null">#{status},
|
||
|
</if>
|
||
|
<if test="idCard != null">#{idCard},
|
||
|
</if>
|
||
|
<if test="createTime != null">#{createTime},
|
||
|
</if>
|
||
|
<if test="createBy != null">#{createBy},
|
||
|
</if>
|
||
|
<if test="updateTime != null">#{updateTime},
|
||
|
</if>
|
||
|
<if test="updateBy != null">#{updateBy},
|
||
|
</if>
|
||
|
<if test="remark != null">#{remark},
|
||
|
</if>
|
||
|
<if test="bornDay != null">#{bornDay},
|
||
|
</if>
|
||
|
<if test="certAddress != null">#{certAddress},
|
||
|
</if>
|
||
|
<if test="certNumber != null">#{certNumber},
|
||
|
</if>
|
||
|
<if test="certOrg != null">#{certOrg},
|
||
|
</if>
|
||
|
<if test="certType != null">#{certType},
|
||
|
</if>
|
||
|
<if test="effDate != null">#{effDate},
|
||
|
</if>
|
||
|
<if test="expDate != null">#{expDate},
|
||
|
</if>
|
||
|
<if test="gender != null">#{gender},
|
||
|
</if>
|
||
|
<if test="identityPic != null">#{identityPic},
|
||
|
</if>
|
||
|
<if test="nation != null">#{nation},
|
||
|
</if>
|
||
|
<if test="partyName != null">#{partyName},
|
||
|
</if>
|
||
|
<if test="nationCode != null">#{nationCode},
|
||
|
</if>
|
||
|
<if test="faceId != null">#{faceId},
|
||
|
</if>
|
||
|
<if test="faceGroupId != null">#{faceGroupId},
|
||
|
</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
|
||
|
<update id="updateZdyUserTourist" parameterType="ZdyUserTourist">
|
||
|
update zdy_user_tourist
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="userId != null">user_id =
|
||
|
#{userId},
|
||
|
</if>
|
||
|
<if test="name != null">name =
|
||
|
#{name},
|
||
|
</if>
|
||
|
<if test="mobile != null">mobile =
|
||
|
#{mobile},
|
||
|
</if>
|
||
|
<if test="image != null">image =
|
||
|
#{image},
|
||
|
</if>
|
||
|
<if test="status != null">status =
|
||
|
#{status},
|
||
|
</if>
|
||
|
<if test="idCard != null">id_card =
|
||
|
#{idCard},
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time =
|
||
|
#{createTime},
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by =
|
||
|
#{createBy},
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time =
|
||
|
#{updateTime},
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by =
|
||
|
#{updateBy},
|
||
|
</if>
|
||
|
<if test="remark != null">remark =
|
||
|
#{remark},
|
||
|
</if>
|
||
|
<if test="bornDay != null">born_day =
|
||
|
#{bornDay},
|
||
|
</if>
|
||
|
<if test="certAddress != null">cert_address =
|
||
|
#{certAddress},
|
||
|
</if>
|
||
|
<if test="certNumber != null">cert_number =
|
||
|
#{certNumber},
|
||
|
</if>
|
||
|
<if test="certOrg != null">cert_org =
|
||
|
#{certOrg},
|
||
|
</if>
|
||
|
<if test="certType != null">cert_type =
|
||
|
#{certType},
|
||
|
</if>
|
||
|
<if test="effDate != null">eff_date =
|
||
|
#{effDate},
|
||
|
</if>
|
||
|
<if test="expDate != null">exp_date =
|
||
|
#{expDate},
|
||
|
</if>
|
||
|
<if test="gender != null">gender =
|
||
|
#{gender},
|
||
|
</if>
|
||
|
<if test="identityPic != null">identity_pic =
|
||
|
#{identityPic},
|
||
|
</if>
|
||
|
<if test="nation != null">nation =
|
||
|
#{nation},
|
||
|
</if>
|
||
|
<if test="partyName != null">party_name =
|
||
|
#{partyName},
|
||
|
</if>
|
||
|
<if test="nationCode != null">nation_code =
|
||
|
#{nationCode},
|
||
|
</if>
|
||
|
<if test="faceId != null">face_id =
|
||
|
#{faceId},
|
||
|
</if>
|
||
|
<if test="faceGroupId != null">face_group_id =
|
||
|
#{faceGroupId},
|
||
|
</if>
|
||
|
</trim>
|
||
|
where id = #{id}
|
||
|
</update>
|
||
|
|
||
|
<delete id="deleteZdyUserTouristById" parameterType="Long">
|
||
|
delete
|
||
|
from zdy_user_tourist
|
||
|
where id = #{id}
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteZdyUserTouristByIds" parameterType="String">
|
||
|
delete from zdy_user_tourist where id in
|
||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
|
||
|
<select id="selectZdyUserTouristByIdCard" parameterType="String"
|
||
|
resultMap="ZdyUserTouristResult">
|
||
|
<include refid="selectZdyUserTouristVo"/>
|
||
|
where tou.id_card = #{idCard}
|
||
|
</select>
|
||
|
<select id="selectZdyUserTouristByUser" parameterType="Long" resultType="Boolean">
|
||
|
SELECT EXISTS
|
||
|
(
|
||
|
SELECT
|
||
|
*
|
||
|
FROM
|
||
|
zdy_user_tourist
|
||
|
WHERE
|
||
|
user_id = #{userId}
|
||
|
)
|
||
|
</select>
|
||
|
|
||
|
<update id="updateZdyUserTouristByUserId" parameterType="ZdyUserTourist">
|
||
|
update zdy_user_tourist
|
||
|
set status = 0
|
||
|
where user_id = #{userId}
|
||
|
</update>
|
||
|
|
||
|
<select id="selectZdyUserTouristByIdCardAndName" resultMap="ZdyUserTouristResult">
|
||
|
SELECT tou.id,
|
||
|
tou.user_id,
|
||
|
tou.NAME,
|
||
|
tou.mobile,
|
||
|
tou.image,
|
||
|
tou.STATUS,
|
||
|
tou.id_card,
|
||
|
tou.create_time,
|
||
|
tou.create_by,
|
||
|
tou.update_time,
|
||
|
tou.update_by,
|
||
|
tou.remark,
|
||
|
tou.born_day,
|
||
|
tou.cert_address,
|
||
|
tou.cert_number,
|
||
|
tou.cert_org,
|
||
|
tou.cert_type,
|
||
|
tou.eff_date,
|
||
|
tou.exp_date,
|
||
|
tou.gender,
|
||
|
tou.identity_pic,
|
||
|
tou.nation,
|
||
|
tou.party_name,
|
||
|
tou.nation_code,
|
||
|
tou.face_id,
|
||
|
tou.face_group_id
|
||
|
FROM zdy_user_tourist tou
|
||
|
where tou.id_card = #{idCard} and tou.name = #{name} limit 1
|
||
|
</select>
|
||
|
<select id="selectUserTouristIsOrder" parameterType="Long" resultType="int">
|
||
|
SELECT
|
||
|
count( 1 )
|
||
|
FROM
|
||
|
zdy_ticket_order_item toi
|
||
|
LEFT JOIN zdy_ticket_order_detail tod ON tod.order_item_id = toi.id
|
||
|
WHERE
|
||
|
( tod.user_tourist_id = #{touristId} OR toi.tour_id = #{touristId} )
|
||
|
AND toi.classify = 5
|
||
|
AND toi.payment_type = 200
|
||
|
AND tod.refund_status != 200
|
||
|
</select>
|
||
|
<select id="selectTouristByUserIdAndIdCardAndName" resultMap="ZdyUserTouristResult">
|
||
|
SELECT tou.id,
|
||
|
tou.user_id,
|
||
|
tou.NAME,
|
||
|
tou.mobile,
|
||
|
tou.image,
|
||
|
tou.STATUS,
|
||
|
tou.id_card,
|
||
|
tou.create_time,
|
||
|
tou.create_by,
|
||
|
tou.update_time,
|
||
|
tou.update_by,
|
||
|
tou.remark,
|
||
|
tou.born_day,
|
||
|
tou.cert_address,
|
||
|
tou.cert_number,
|
||
|
tou.cert_org,
|
||
|
tou.cert_type,
|
||
|
tou.eff_date,
|
||
|
tou.exp_date,
|
||
|
tou.gender,
|
||
|
tou.identity_pic,
|
||
|
tou.nation,
|
||
|
tou.party_name,
|
||
|
tou.nation_code,
|
||
|
tou.face_id,
|
||
|
tou.face_group_id
|
||
|
FROM zdy_user_tourist tou
|
||
|
where tou.id_card = #{idCard} and tou.name = #{name} and tou.user_id = #{userId} limit 1
|
||
|
</select>
|
||
|
|
||
|
<select id="getByIdentityAndName" resultMap="ZdyUserTouristResult">
|
||
|
SELECT tou.id,
|
||
|
tou.user_id,
|
||
|
tou.NAME,
|
||
|
tou.mobile,
|
||
|
tou.STATUS,
|
||
|
tou.id_card,
|
||
|
tou.create_time,
|
||
|
tou.create_by,
|
||
|
tou.update_time,
|
||
|
tou.update_by,
|
||
|
tou.remark,
|
||
|
tou.born_day,
|
||
|
tou.cert_address,
|
||
|
tou.cert_number,
|
||
|
tou.cert_org,
|
||
|
tou.cert_type,
|
||
|
tou.eff_date,
|
||
|
tou.exp_date,
|
||
|
tou.gender,
|
||
|
tou.identity_pic,
|
||
|
tou.nation,
|
||
|
tou.party_name,
|
||
|
tou.nation_code
|
||
|
FROM zdy_user_tourist tou
|
||
|
where tou.id_card = #{idCard}
|
||
|
and tou.name = #{name}
|
||
|
and tou.cert_type = #{cert_type}
|
||
|
and tou.user_id = 0
|
||
|
limit 1
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyUserTouristByUserId" resultMap="ZdyUserTouristResult">
|
||
|
SELECT id,
|
||
|
user_id,
|
||
|
NAME,
|
||
|
mobile,
|
||
|
STATUS,
|
||
|
id_card,
|
||
|
create_time,
|
||
|
create_by,
|
||
|
update_time,
|
||
|
update_by,
|
||
|
remark,
|
||
|
born_day,
|
||
|
cert_address,
|
||
|
cert_number,
|
||
|
cert_org,
|
||
|
cert_type,
|
||
|
eff_date,
|
||
|
exp_date,
|
||
|
gender,
|
||
|
identity_pic,
|
||
|
nation,
|
||
|
party_name,
|
||
|
nation_code
|
||
|
FROM zdy_user_tourist
|
||
|
where user_id = #{userId} limit 1
|
||
|
</select>
|
||
|
|
||
|
</mapper>
|