Files
zxjp-web/coolstore-partner-dao/src/main/resources/mapper/HyOutboundMobileMapper.xml
2023-08-09 18:45:16 +08:00

165 lines
5.2 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.cool.store.mapper.HyOutboundMobileMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyOutboundMobileDO">
<id column="id" property="id" />
<result column="mobile" property="mobile" />
<result column="remark" property="remark" />
<result column="create_user_id" property="createUserId" />
<result column="update_user_id" property="updateUserId" />
<result column="deleted" property="deleted" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
id, mobile, remark, create_user_id, update_user_id, deleted, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from hy_outbound_mobile
where id = #{id}
</select>
<select id="selectByPrimarySelective" resultType="com.cool.store.entity.HyOutboundMobileDO">
select <include refid="Base_Column_List" />
from hy_outbound_mobile
where deleted = 0
<if test="id != null">
id = #{id}
</if>
<if test="mobile != null">
and mobile = #{mobile}
</if>
<if test="remark != null">
and remark = #{remark}
</if>
<if test="createUserId != null">
and create_user_id = #{createUserId}
</if>
<if test="updateUserId != null">
and update_user_id = #{updateUserId}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from hy_outbound_mobile
where id = #{id}
</delete>
<insert id="insert" parameterType="com.cool.store.entity.HyOutboundMobileDO">
insert into hy_outbound_mobile (id, mobile, remark,
create_user_id, update_user_id, deleted,
create_time, update_time)
values (#{id}, #{mobile}, #{remark},
#{createUserId}, #{updateUserId}, #{deleted},
#{createTime}, #{updateTime})
</insert>
<insert id="insertSelective" parameterType="com.cool.store.entity.HyOutboundMobileDO">
insert into hy_outbound_mobile
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="mobile != null">
mobile,
</if>
<if test="remark != null">
remark,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="updateUserId != null">
update_user_id,
</if>
<if test="deleted != null">
deleted,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="mobile != null">
#{mobile},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="createUserId != null">
#{createUserId},
</if>
<if test="updateUserId != null">
#{updateUserId},
</if>
<if test="deleted != null">
#{deleted},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.cool.store.entity.HyOutboundMobileDO">
update hy_outbound_mobile
<set>
<if test="mobile != null">
mobile = #{mobile},
</if>
<if test="remark != null">
remark = #{remark},
</if>
<if test="createUserId != null">
create_user_id = #{createUserId},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId},
</if>
<if test="deleted != null">
deleted = #{deleted},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
where id = #{id}
</update>
<update id="updateByPrimaryKey" parameterType="com.cool.store.entity.HyOutboundMobileDO">
update hy_outbound_mobile
set mobile = #{mobile},
remark = #{remark},
create_user_id = #{createUserId},
update_user_id = #{updateUserId},
deleted = #{deleted},
create_time = #{createTime},
update_time = #{updateTime}
where id = #{id}
</update>
<!-- 获取呼出手机号列表 -->
<select id="getOutboundNumberList" resultType="com.cool.store.vo.HyOutboundVo">
SELECT t1.id, t1.mobile as outboundNumber, t2.name as updaterName, t2.mobile as updaterMobile, t1.update_time as update_time
FROM hy_outbound_mobile t1
LEFT JOIN enterprise_user t2 ON t1.update_user_id = t2.user_id
WHERE t2.deleted = 0 AND t1.deleted = 0
AND t1.update_user_id = #{userId}
</select>
</mapper>