emis-service/emis-biz/src/main/resources/mapper/EmisSmsSendRecordMapper.xml
2025-03-18 11:03:03 +08:00

205 lines
13 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.xdadan.erp.emis.mapper.EmisSmsSendRecordMapper">
<resultMap type="EmisSmsSendRecord" id="EmisSmsSendRecordResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="billCode" column="bill_code" />
<result property="sendSiteCode" column="send_site_code" />
<result property="sendSiteName" column="send_site_name" />
<result property="sendManName" column="send_man_name" />
<result property="sendManCode" column="send_man_code" />
<result property="smsType" column="sms_type" />
<result property="phone" column="phone" />
<result property="content" column="content" />
<result property="fee" column="fee" />
<result property="smsChannel" column="sms_channel" />
<result property="sendDate" column="send_date" />
<result property="sendStatus" column="send_status" />
<result property="errCode" column="err_code" />
<result property="errMsg" column="err_msg" />
<result property="taskDate" column="task_date" />
</resultMap>
<sql id="selectEmisSmsSendRecordVo">
select id, bill_code, send_site_code, send_site_name, send_man_name, send_man_code, sms_type, phone, content, fee, sms_channel, send_date, send_status, err_code, err_msg, task_date, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_sms_send_record
</sql>
<select id="selectEmisSmsSendRecordList" parameterType="EmisSmsSendRecord" resultMap="EmisSmsSendRecordResult">
<include refid="selectEmisSmsSendRecordVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="billCode != null and billCode != ''"> and ( FIND_IN_SET(`bill_code`,#{billCode}) or bill_code like concat('%', #{billCode}, '%') ) </if>
<if test="sendSiteCode != null and sendSiteCode != ''"> and send_site_code= #{sendSiteCode}</if>
<if test="sendSiteName != null and sendSiteName != ''"> and send_site_name like concat('%', #{sendSiteName}, '%')</if>
<if test="sendManName != null and sendManName != ''"> and send_man_name like concat('%', #{sendManName}, '%')</if>
<if test="sendManCode != null and sendManCode != ''"> and send_man_code=#{sendManCode}</if>
<if test="smsType != null and smsType != ''"> and sms_type like concat('%', #{smsType}, '%')</if>
<if test="phone != null and phone != ''"> and ( FIND_IN_SET(`phone`,#{phone}) or phone like concat('%', #{phone}, '%') ) </if>
<if test="content != null and content != ''"> and content like concat('%', #{content}, '%')</if>
<if test="fee != null and fee != ''"> and fee like concat('%', #{fee}, '%')</if>
<if test="smsChannel != null and smsChannel != ''"> and sms_channel=#{smsChannel}</if>
<if test="sendDate != null "> and send_date = #{sendDate}</if>
<if test="sendStatus != null and sendStatus != ''"> and send_status=#{sendStatus}</if>
<if test="errCode != null and errCode != ''"> and err_code=#{errCode}</if>
<if test="errMsg != null and errMsg != ''"> and err_msg like concat('%', #{errMsg}, '%')</if>
<if test="taskDate != null "> and task_date = #{taskDate}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
and create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.needSend != null and params.needSend != '1'">
and send_status = '0'
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
send_site_code=#{params.privSiteCode}
)
</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisSmsSendRecord" resultType="int">
select count(1) from emis_sms_send_record
where del_flag='0'
and bill_code = #{billCode}
and sms_type = #{smsType}
and phone = #{phone}
and content = #{content}
limit 1
</select>
<select id="selectEmisSmsSendRecordById" parameterType="Long" resultMap="EmisSmsSendRecordResult">
select id, bill_code, send_site_code, send_site_name, send_man_name, send_man_code, sms_type, phone, content, fee, sms_channel, send_date, send_status, err_code, err_msg, task_date, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_sms_send_record a
where a.id = #{id}
</select>
<insert id="insertEmisSmsSendRecord" parameterType="EmisSmsSendRecord" useGeneratedKeys="true" keyProperty="id">
insert into emis_sms_send_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="billCode != null and billCode != ''">bill_code,</if>
<if test="sendSiteCode != null and sendSiteCode != ''">send_site_code,</if>
<if test="sendSiteName != null and sendSiteName != ''">send_site_name,</if>
<if test="sendManName != null and sendManName != ''">send_man_name,</if>
<if test="sendManCode != null and sendManCode != ''">send_man_code,</if>
<if test="smsType != null and smsType != ''">sms_type,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="content != null and content != ''">content,</if>
<if test="fee != null and fee != ''">fee,</if>
<if test="smsChannel != null and smsChannel != ''">sms_channel,</if>
<if test="sendDate != null">send_date,</if>
<if test="sendStatus != null and sendStatus != ''">send_status,</if>
<if test="errCode != null and errCode != ''">err_code,</if>
<if test="errMsg != null and errMsg != ''">err_msg,</if>
<if test="taskDate != null">task_date,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</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="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="billCode != null and billCode != ''">#{billCode},</if>
<if test="sendSiteCode != null and sendSiteCode != ''">#{sendSiteCode},</if>
<if test="sendSiteName != null and sendSiteName != ''">#{sendSiteName},</if>
<if test="sendManName != null and sendManName != ''">#{sendManName},</if>
<if test="sendManCode != null and sendManCode != ''">#{sendManCode},</if>
<if test="smsType != null and smsType != ''">#{smsType},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="fee != null and fee != ''">#{fee},</if>
<if test="smsChannel != null and smsChannel != ''">#{smsChannel},</if>
<if test="sendDate != null">#{sendDate},</if>
<if test="sendStatus != null and sendStatus != ''">#{sendStatus},</if>
<if test="errCode != null and errCode != ''">#{errCode},</if>
<if test="errMsg != null and errMsg != ''">#{errMsg},</if>
<if test="taskDate != null">#{taskDate},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</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="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
</insert>
<update id="updateEmisSmsSendRecord" parameterType="EmisSmsSendRecord">
update emis_sms_send_record
<trim prefix="SET" suffixOverrides=",">
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
<if test="sendSiteCode != null and sendSiteCode != ''">send_site_code = #{sendSiteCode},</if>
<if test="sendSiteName != null and sendSiteName != ''">send_site_name = #{sendSiteName},</if>
<if test="sendManName != null and sendManName != ''">send_man_name = #{sendManName},</if>
<if test="sendManCode != null and sendManCode != ''">send_man_code = #{sendManCode},</if>
<if test="smsType != null and smsType != ''">sms_type = #{smsType},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="fee != null and fee != ''">fee = #{fee},</if>
<if test="smsChannel != null and smsChannel != ''">sms_channel = #{smsChannel},</if>
<if test="sendDate != null">send_date = #{sendDate},</if>
<if test="sendStatus != null and sendStatus != ''">send_status = #{sendStatus},</if>
<if test="errCode != null and errCode != ''">err_code = #{errCode},</if>
<if test="errMsg != null and errMsg != ''">err_msg = #{errMsg},</if>
<if test="taskDate != null">task_date = #{taskDate},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<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="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisSmsSendRecordById" parameterType="Long">
update emis_sms_send_record set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisSmsSendRecordByIds" parameterType="String">
update emis_sms_send_record set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>