| | |
| | | </foreach> |
| | | </insert> |
| | | |
| | | |
| | | <!--站内信消息记录列表查询--> |
| | | <select id="msgPage" resultType="cn.gistack.alerts.sms.vo.SmsRecordVO"> |
| | | select |
| | | smr.id,smr.content,smr.create_time,'发送成功' as responseMsg,smr.template_id, |
| | | a."name" as resName, |
| | | bu.name as userName,bu.phone as tel, |
| | | 2 as type, |
| | | sar.rule_name as ruleName,sst.sms_type as smsType |
| | | from YWXT.sm_message_record smr |
| | | left join SJZT_MD."att_res_base" a on a."guid" = smr.res_guid |
| | | left join YWXT.blade_user bu on CAST(bu.id AS VARCHAR) = smr.recipient and bu.is_deleted = 0 |
| | | left join YWXT.sm_alarm_rule sar on sar.id = smr.alarm_rule_id |
| | | left join YWXT.sm_sms_template sst on sst.template_id = smr.template_id and sst.is_deleted = 0 |
| | | <where> |
| | | <if test="smsRecord.templateId!=null and smsRecord.templateId!=''"> |
| | | and smr.template_id = #{smsRecord.templateId} |
| | | </if> |
| | | <if test="smsRecord.smsType!=null and smsRecord.smsType!=''"> |
| | | and sst.sms_type = #{smsRecord.smsType} |
| | | </if> |
| | | <if test="smsRecord.tel!=null and smsRecord.tel!=''"> |
| | | and bu.phone = #{smsRecord.tel} |
| | | </if> |
| | | <if test="smsRecord.content!=null and smsRecord.content!=''"> |
| | | and smr.content like concat(concat('%',#{smsRecord.content}),'%') |
| | | </if> |
| | | <if test="smsRecord.userName!=null and smsRecord.userName!=''"> |
| | | and bu.name like concat(concat('%',#{smsRecord.userName}),'%') |
| | | </if> |
| | | <if test="smsRecord.resName!=null and smsRecord.resName!=''"> |
| | | and a."name" like concat(concat('%',#{smsRecord.resName}),'%') |
| | | </if> |
| | | <if test="smsRecord.startTime!=null and smsRecord.startTime!=''"> |
| | | and DATE_FORMAT(smr.create_time,'%Y-%m-%d') >= #{smsRecord.startTime} |
| | | </if> |
| | | <if test="smsRecord.endTime!=null and smsRecord.endTime!=''"> |
| | | and DATE_FORMAT(smr.create_time,'%Y-%m-%d') <= #{smsRecord.endTime} |
| | | </if> |
| | | <if test="list!=null and list.size()>0"> |
| | | and smr.template_id in |
| | | <foreach collection="list" item="id" separator ="," open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | order by smr.id desc |
| | | </select> |
| | | |
| | | <!--短信消息记录列表查询--> |
| | | <select id="smsPage" resultType="cn.gistack.alerts.sms.vo.SmsRecordVO"> |
| | | select |
| | | ssr.id,ssr.tel,ssr.content,ssr.create_time,ssr.response_msg,ssr.template_id, |
| | | a."name" as resName, |
| | | bu.name as userName, |
| | | 1 as type, |
| | | sar.rule_name as ruleName,sst.sms_type as smsType |
| | | from YWXT.sm_sms_record ssr |
| | | left join SJZT_MD."att_res_base" a on a."guid" = ssr.res_guid |
| | | left join YWXT.blade_user bu on bu.account = ssr.tel and bu.is_deleted = 0 |
| | | left join YWXT.sm_alarm_rule sar on sar.id = ssr.alarm_rule_id |
| | | left join YWXT.sm_sms_template sst on sst.template_id = ssr.template_id and sst.is_deleted = 0 |
| | | <where> |
| | | <if test="smsRecord.templateId!=null and smsRecord.templateId!=''"> |
| | | and ssr.template_id = #{smsRecord.templateId} |
| | | </if> |
| | | <if test="smsRecord.smsType!=null and smsRecord.smsType!=''"> |
| | | and sst.sms_type = #{smsRecord.smsType} |
| | | </if> |
| | | <if test="smsRecord.tel!=null and smsRecord.tel!=''"> |
| | | and ssr.tel = #{smsRecord.tel} |
| | | </if> |
| | | <if test="smsRecord.content!=null and smsRecord.content!=''"> |
| | | and ssr.content like concat(concat('%',#{smsRecord.content}),'%') |
| | | </if> |
| | | <if test="smsRecord.userName!=null and smsRecord.userName!=''"> |
| | | and bu.name like concat(concat('%',#{smsRecord.userName}),'%') |
| | | </if> |
| | | <if test="smsRecord.resName!=null and smsRecord.resName!=''"> |
| | | and a."name" like concat(concat('%',#{smsRecord.resName}),'%') |
| | | </if> |
| | | <if test="smsRecord.startTime!=null and smsRecord.startTime!=''"> |
| | | and DATE_FORMAT(ssr.create_time,'%Y-%m-%d') >= #{smsRecord.startTime} |
| | | </if> |
| | | <if test="smsRecord.endTime!=null and smsRecord.endTime!=''"> |
| | | and DATE_FORMAT(ssr.create_time,'%Y-%m-%d') <= #{smsRecord.endTime} |
| | | </if> |
| | | <if test="list!=null and list.size()>0"> |
| | | and ssr.template_id in |
| | | <foreach collection="list" item="id" separator="," open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | order by ssr.id desc |
| | | </select> |
| | | |
| | | |
| | | <!--短信和站内信消息记录列表查询--> |
| | | <select id="smsAndMsgPage" resultType="cn.gistack.alerts.sms.vo.SmsRecordVO"> |
| | | (select |
| | | ssr.id,ssr.tel,ssr.content,ssr.create_time,ssr.response_msg,ssr.template_id, |
| | | a."name" as resName, |
| | | bu.name as userName, |
| | | 1 as type, |
| | | sar.rule_name as ruleName,sst.sms_type as smsType |
| | | from YWXT.sm_sms_record ssr |
| | | left join SJZT_MD."att_res_base" a on a."guid" = ssr.res_guid |
| | | left join YWXT.blade_user bu on bu.account = ssr.tel and bu.is_deleted = 0 |
| | | left join YWXT.sm_alarm_rule sar on sar.id = ssr.alarm_rule_id |
| | | left join YWXT.sm_sms_template sst on sst.template_id = ssr.template_id and sst.is_deleted = 0 |
| | | <where> |
| | | <if test="smsRecord.templateId!=null and smsRecord.templateId!=''"> |
| | | and ssr.template_id = #{smsRecord.templateId} |
| | | </if> |
| | | <if test="smsRecord.smsType!=null and smsRecord.smsType!=''"> |
| | | and sst.sms_type = #{smsRecord.smsType} |
| | | </if> |
| | | <if test="smsRecord.tel!=null and smsRecord.tel!=''"> |
| | | and ssr.tel = #{smsRecord.tel} |
| | | </if> |
| | | <if test="smsRecord.content!=null and smsRecord.content!=''"> |
| | | and ssr.content like concat(concat('%',#{smsRecord.content}),'%') |
| | | </if> |
| | | <if test="smsRecord.userName!=null and smsRecord.userName!=''"> |
| | | and bu.name like concat(concat('%',#{smsRecord.userName}),'%') |
| | | </if> |
| | | <if test="smsRecord.resName!=null and smsRecord.resName!=''"> |
| | | and a."name" like concat(concat('%',#{smsRecord.resName}),'%') |
| | | </if> |
| | | <if test="smsRecord.startTime!=null and smsRecord.startTime!=''"> |
| | | and DATE_FORMAT(ssr.create_time,'%Y-%m-%d') >= #{smsRecord.startTime} |
| | | </if> |
| | | <if test="smsRecord.endTime!=null and smsRecord.endTime!=''"> |
| | | and DATE_FORMAT(ssr.create_time,'%Y-%m-%d') <= #{smsRecord.endTime} |
| | | </if> |
| | | <if test="list!=null and list.size()>0"> |
| | | and ssr.template_id in |
| | | <foreach collection="list" item="id" separator="," open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ) |
| | | union all |
| | | ( |
| | | select |
| | | smr.id,smr.content,smr.create_time,'发送成功' as responseMsg,smr.template_id, |
| | | a."name" as resName, |
| | | bu.name as userName,bu.phone as tel, |
| | | 2 as type, |
| | | sar.rule_name as ruleName,sst.sms_type as smsType |
| | | from YWXT.sm_message_record smr |
| | | left join SJZT_MD."att_res_base" a on a."guid" = smr.res_guid |
| | | left join YWXT.blade_user bu on CAST(bu.id AS VARCHAR) = smr.recipient and bu.is_deleted = 0 |
| | | left join YWXT.sm_alarm_rule sar on sar.id = smr.alarm_rule_id |
| | | left join YWXT.sm_sms_template sst on sst.template_id = smr.template_id and sst.is_deleted = 0 |
| | | <where> |
| | | <if test="smsRecord.templateId!=null and smsRecord.templateId!=''"> |
| | | and smr.template_id = #{smsRecord.templateId} |
| | | </if> |
| | | <if test="smsRecord.smsType!=null and smsRecord.smsType!=''"> |
| | | and sst.sms_type = #{smsRecord.smsType} |
| | | </if> |
| | | <if test="smsRecord.tel!=null and smsRecord.tel!=''"> |
| | | and bu.phone = #{smsRecord.tel} |
| | | </if> |
| | | <if test="smsRecord.content!=null and smsRecord.content!=''"> |
| | | and smr.content like concat(concat('%',#{smsRecord.content}),'%') |
| | | </if> |
| | | <if test="smsRecord.userName!=null and smsRecord.userName!=''"> |
| | | and bu.name like concat(concat('%',#{smsRecord.userName}),'%') |
| | | </if> |
| | | <if test="smsRecord.resName!=null and smsRecord.resName!=''"> |
| | | and a."name" like concat(concat('%',#{smsRecord.resName}),'%') |
| | | </if> |
| | | <if test="smsRecord.startTime!=null and smsRecord.startTime!=''"> |
| | | and DATE_FORMAT(smr.create_time,'%Y-%m-%d') >= #{smsRecord.startTime} |
| | | </if> |
| | | <if test="smsRecord.endTime!=null and smsRecord.endTime!=''"> |
| | | and DATE_FORMAT(smr.create_time,'%Y-%m-%d') <= #{smsRecord.endTime} |
| | | </if> |
| | | <if test="list!=null and list.size()>0"> |
| | | and smr.template_id in |
| | | <foreach collection="list" item="id" separator ="," open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ) |
| | | </select> |
| | | |
| | | </mapper> |