2024-02-25 11:16:55 +08:00
|
|
|
<?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.ics.admin.mapper.IcsCustomerStaffMapper">
|
|
|
|
|
2024-03-13 15:15:35 +08:00
|
|
|
<resultMap type="com.ics.common.core.domain.IcsCustomerStaff" id="IcsCustomerStaffResult">
|
2024-02-25 11:16:55 +08:00
|
|
|
<result property="id" column="id" />
|
|
|
|
<result property="username" column="username" />
|
2024-03-29 08:55:47 +08:00
|
|
|
<result property="name" column="name" />
|
|
|
|
<result property="photo" column="photo" />
|
|
|
|
<result property="address" column="address" />
|
|
|
|
<result property="email" column="email" />
|
|
|
|
<result property="degree" column="degree" />
|
|
|
|
<result property="urgent" column="urgent" />
|
2024-02-25 11:16:55 +08:00
|
|
|
<result property="mobile" column="mobile" />
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
<result property="deleteFlag" column="delete_flag" />
|
|
|
|
<result property="icsCustomerId" column="ics_customer_id" />
|
|
|
|
<result property="openid" column="openid" />
|
|
|
|
<result property="avatar" column="avatar" />
|
|
|
|
<result property="gender" column="gender" />
|
|
|
|
<result property="status" column="status" />
|
|
|
|
<result property="parkId" column="park_id" />
|
2024-02-25 16:43:09 +08:00
|
|
|
<result property="cardNo" column="card_no" />
|
|
|
|
<result property="visitTime" column="visit_time" />
|
|
|
|
<result property="leaveTime" column="leave_time" />
|
|
|
|
<result property="visitContent" column="visit_content" />
|
|
|
|
<result property="toName" column="to_name" />
|
|
|
|
<result property="toPhone" column="to_phone" />
|
|
|
|
<result property="toCustomer" column="to_customer" />
|
|
|
|
<result property="toCustomerId" column="to_customer_id" />
|
|
|
|
<result property="dataType" column="data_type" />
|
2024-02-25 11:16:55 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectIcsCustomerStaffVo">
|
2024-03-29 08:55:47 +08:00
|
|
|
SELECT id, username, mobile, create_by, create_time, update_by,name,photo,address,email,degree,urgent, update_time, delete_flag, ics_customer_id, openid, avatar, gender, status, park_id,card_no, visit_time,
|
2024-02-25 16:43:09 +08:00
|
|
|
leave_time,visit_content,to_name,to_phone,to_customer,to_customer_id,data_type
|
|
|
|
FROM ics_customer_staff
|
2024-02-25 11:16:55 +08:00
|
|
|
</sql>
|
|
|
|
|
2024-03-13 15:15:35 +08:00
|
|
|
<select id="selectIcsCustomerStaffList" parameterType="com.ics.common.core.domain.IcsCustomerStaff" resultMap="IcsCustomerStaffResult">
|
2024-04-09 10:02:49 +08:00
|
|
|
SELECT cs.id, cs.username, cs.mobile, cs.create_by, cs.create_time, cs.update_by,cs.name,cs.photo,cs.address,cs.email,cs.degree,cs.urgent,cs.update_time,
|
|
|
|
cs.delete_flag, cs.ics_customer_id, cs.openid, cs.avatar, cs.gender, cs.status, cs.park_id,cs.card_no,cs.data_type
|
|
|
|
FROM ics_customer_staff cs
|
|
|
|
left join tb_staff_customer tsc on cs.id = tsc.staff_id
|
2024-02-25 11:16:55 +08:00
|
|
|
<where>
|
2024-04-09 10:02:49 +08:00
|
|
|
<if test="username != null and username != ''"> AND cs.username LIKE CONCAT('%', #{username}, '%') </if>
|
|
|
|
<if test="icsCustomerId != null and icsCustomerId != ''"> AND tsc.ics_customer_id = #{icsCustomerId} </if>
|
|
|
|
<if test="mobile != null and mobile != ''"> AND cs.mobile LIKE CONCAT('%', #{mobile}, '%') </if>
|
|
|
|
<if test="name != null and name != ''"> AND cs.name LIKE CONCAT('%', #{name}, '%') </if>
|
|
|
|
<if test="dataType != null and dataType != ''"> AND cs.data_type = #{dataType} </if>
|
|
|
|
<if test="parkId != null and parkId != ''"> AND cs.park_id = #{parkId} </if>
|
|
|
|
<if test="tenantId != null and tenantId != ''"> AND cs.tenant_id = #{tenantId} </if>
|
2024-02-25 11:16:55 +08:00
|
|
|
</where>
|
2024-04-09 10:02:49 +08:00
|
|
|
|
2024-02-25 11:16:55 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectIcsCustomerStaffById" parameterType="Long" resultMap="IcsCustomerStaffResult">
|
|
|
|
<include refid="selectIcsCustomerStaffVo"/>
|
|
|
|
WHERE id = #{id}
|
|
|
|
</select>
|
|
|
|
|
2024-03-13 15:15:35 +08:00
|
|
|
<insert id="insertIcsCustomerStaff" parameterType="com.ics.common.core.domain.IcsCustomerStaff">
|
2024-02-25 11:16:55 +08:00
|
|
|
INSERT INTO ics_customer_staff
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="id != null ">id,</if>
|
|
|
|
<if test="username != null and username != ''">username,</if>
|
2024-03-29 08:55:47 +08:00
|
|
|
<if test="name != null and name != ''">`name`,</if>
|
|
|
|
<if test="photo != null and photo != ''">`photo`,</if>
|
|
|
|
<if test="address != null and address != ''">address,</if>
|
|
|
|
<if test="email != null and email != ''">email,</if>
|
|
|
|
<if test="degree != null and degree != ''">`degree`,</if>
|
|
|
|
<if test="urgent != null and urgent != ''">urgent,</if>
|
2024-02-25 11:16:55 +08:00
|
|
|
<if test="mobile != null and mobile != ''">mobile,</if>
|
|
|
|
<if test="password != null and password != ''">password,</if>
|
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
|
<if test="createTime != null ">create_time,</if>
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
|
|
<if test="updateTime != null ">update_time,</if>
|
|
|
|
<if test="deleteFlag != null ">delete_flag,</if>
|
|
|
|
<if test="icsCustomerId != null ">ics_customer_id,</if>
|
|
|
|
<if test="openid != null and openid != ''">openid,</if>
|
|
|
|
<if test="avatar != null and avatar != ''">avatar,</if>
|
|
|
|
<if test="gender != null and gender != ''">gender,</if>
|
|
|
|
<if test="status != null and status != ''">status,</if>
|
|
|
|
<if test="parkId != null ">park_id,</if>
|
2024-02-25 16:43:09 +08:00
|
|
|
<if test="cardNo != null and cardNo !=''">,</if>
|
|
|
|
<if test="visitTime != null ">,</if>
|
|
|
|
<if test="leaveTime != null ">,</if>
|
|
|
|
<if test="visitContent != null and visitContent !=''">,</if>
|
|
|
|
<if test="toName != null and toName!=''">,</if>
|
|
|
|
<if test="toPhone != null and toPhone!=''">,</if>
|
|
|
|
<if test="toCustomer != null and toCustomer!=''">,</if>
|
|
|
|
<if test="toCustomerId != null and toCustomerId!=''">,</if>
|
|
|
|
<if test="dataType != null dataType!=''">,</if>
|
2024-02-25 11:16:55 +08:00
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="id != null ">#{id},</if>
|
|
|
|
<if test="username != null and username != ''">#{username},</if>
|
|
|
|
<if test="mobile != null and mobile != ''">#{mobile},</if>
|
2024-03-29 08:55:47 +08:00
|
|
|
<if test="name != null and name != ''">#{name},</if>
|
|
|
|
<if test="photo != null and photo != ''">#{photo},</if>
|
|
|
|
<if test="address != null and address != ''">#{address},</if>
|
|
|
|
<if test="email != null and email != ''">#{email},</if>
|
|
|
|
<if test="degree != null and degree != ''">#{degree},</if>
|
|
|
|
<if test="urgent != null and urgent != ''">#{urgent},</if>
|
2024-02-25 11:16:55 +08:00
|
|
|
<if test="password != null and password != ''">#{password},</if>
|
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
|
<if test="createTime != null ">#{createTime},</if>
|
|
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
|
|
<if test="updateTime != null ">#{updateTime},</if>
|
|
|
|
<if test="deleteFlag != null ">#{deleteFlag},</if>
|
|
|
|
<if test="icsCustomerId != null ">#{icsCustomerId},</if>
|
|
|
|
<if test="openid != null and openid != ''">#{openid},</if>
|
|
|
|
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
|
|
|
<if test="gender != null and gender != ''">#{gender},</if>
|
|
|
|
<if test="status != null and status != ''">#{status},</if>
|
|
|
|
<if test="parkId != null ">#{parkId},</if>
|
2024-02-25 16:43:09 +08:00
|
|
|
<if test="cardNo != null and cardNo !=''">#{cardNo}</if>
|
|
|
|
<if test="visitTime != null ">#{visitTime}</if>
|
|
|
|
<if test="leaveTime != null ">#{leaveTime}</if>
|
|
|
|
<if test="visitContent != null and visitContent !=''">#{visitContent}</if>
|
|
|
|
<if test="toName != null and toName!=''">#{toName}</if>
|
|
|
|
<if test="toPhone != null and toPhone!=''">#{toPhone}</if>
|
|
|
|
<if test="toCustomer != null and toCustomer!=''">#{toCustomer}</if>
|
|
|
|
<if test="toCustomerId != null and toCustomerId!=''">#{toCustomerId}</if>
|
|
|
|
<if test="dataType != null dataType!=''">#{dataType}</if>
|
2024-02-25 11:16:55 +08:00
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
2024-03-13 15:15:35 +08:00
|
|
|
<update id="updateIcsCustomerStaff" parameterType="com.ics.common.core.domain.IcsCustomerStaff">
|
2024-02-25 11:16:55 +08:00
|
|
|
UPDATE ics_customer_staff
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="username != null and username != ''">username = #{username},</if>
|
|
|
|
<if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
|
|
|
|
<if test="password != null and password != ''">password = #{password},</if>
|
2024-03-29 08:55:47 +08:00
|
|
|
<if test="name != null and name != ''">`name` = #{name},</if>
|
|
|
|
<if test="photo != null and photo != ''">`photo` = #{photo},</if>
|
|
|
|
<if test="address != null and address != ''">`address` = #{address},</if>
|
|
|
|
<if test="email != null and email != ''">`email` = #{email},</if>
|
|
|
|
<if test="degree != null and degree != ''">`degree` = #{degree},</if>
|
|
|
|
<if test="urgent != null and urgent != ''">`urgent` = #{urgent},</if>
|
2024-02-25 11:16:55 +08:00
|
|
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
|
|
<if test="createTime != null ">create_time = #{createTime},</if>
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
|
|
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
|
|
|
<if test="deleteFlag != null ">delete_flag = #{deleteFlag},</if>
|
|
|
|
<if test="icsCustomerId != null ">ics_customer_id = #{icsCustomerId},</if>
|
|
|
|
<if test="openid != null and openid != ''">openid = #{openid},</if>
|
|
|
|
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
|
|
|
<if test="gender != null and gender != ''">gender = #{gender},</if>
|
|
|
|
<if test="status != null and status != ''">status = #{status},</if>
|
|
|
|
<if test="parkId != null ">park_id = #{parkId},</if>
|
2024-02-25 16:43:09 +08:00
|
|
|
<if test="cardNo != null and cardNo !=''">card_no = #{cardNo}</if>
|
|
|
|
<if test="visitTime != null ">visit_time = #{visitTime}</if>
|
|
|
|
<if test="leaveTime != null ">leave_time = #{leaveTime}</if>
|
|
|
|
<if test="visitContent != null and visitContent !=''">visit_content = #{visitContent}</if>
|
|
|
|
<if test="toName != null and toName!=''">to_name = #{toName}</if>
|
|
|
|
<if test="toPhone != null and toPhone!=''">to_phone = #{toPhone}</if>
|
|
|
|
<if test="toCustomer != null and toCustomer!=''">to_customer = #{toCustomer}</if>
|
|
|
|
<if test="toCustomerId != null and toCustomerId!=''">to_customer_id = #{toCustomerId}</if>
|
2024-02-25 11:16:55 +08:00
|
|
|
</trim>
|
|
|
|
WHERE id = #{id}
|
|
|
|
</update>
|
2024-03-29 08:55:47 +08:00
|
|
|
<update id="updateByCustomer" parameterType="Long">
|
|
|
|
UPDATE ics_customer_staff set ics_customer_id = null where id = #{id}
|
|
|
|
</update>
|
2024-02-25 11:16:55 +08:00
|
|
|
|
|
|
|
<delete id="deleteIcsCustomerStaffById" parameterType="Long">
|
|
|
|
DELETE FROM ics_customer_staff WHERE id = #{id}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteIcsCustomerStaffByIds" parameterType="String">
|
|
|
|
DELETE FROM ics_customer_staff where id in
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
|
2024-03-13 15:15:35 +08:00
|
|
|
<select id="checkPhoneUnique" parameterType="String" resultType="com.ics.common.core.domain.IcsCustomerStaff">
|
2024-02-25 11:16:55 +08:00
|
|
|
<include refid="selectIcsCustomerStaffVo"/>
|
|
|
|
WHERE mobile=#{mobile}
|
|
|
|
</select>
|
2024-03-13 15:15:35 +08:00
|
|
|
<select id="selectUserByOpenid" resultType="com.ics.common.core.domain.IcsCustomerStaff">
|
2024-02-26 15:53:08 +08:00
|
|
|
<include refid="selectIcsCustomerStaffVo"/>
|
|
|
|
WHERE openid=#{openId}
|
|
|
|
</select>
|
2024-03-13 15:15:35 +08:00
|
|
|
<select id="checkMobileUnique" resultType="java.lang.String">
|
|
|
|
SELECT count(1) FROM ics_customer_staff WHERE mobile=#{mobile}
|
|
|
|
</select>
|
2024-04-03 14:28:17 +08:00
|
|
|
<select id="selectUserByMobile" resultType="com.ics.common.core.domain.IcsCustomerStaff">
|
|
|
|
<include refid="selectIcsCustomerStaffVo"/>
|
|
|
|
WHERE mobile=#{mobile}
|
|
|
|
</select>
|
2024-03-13 15:15:35 +08:00
|
|
|
|
2024-02-25 11:16:55 +08:00
|
|
|
|
|
|
|
</mapper>
|