WechatReplyConfigMapper.xml 4.16 KB
<?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="cn.com.glsx.dj.wechat.mapper.WechatReplyConfigMapper" >
  <resultMap id="BaseResultMap" type="cn.com.glsx.dj.wechat.model.WechatReplyConfig" >
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="wechat_appid" property="wechatAppid" jdbcType="VARCHAR" />
    <result column="msg_type" property="msgType" jdbcType="VARCHAR" />
    <result column="content" property="content" jdbcType="VARCHAR" />
    <result column="event" property="event" jdbcType="VARCHAR" />
    <result column="event_key" property="eventKey" jdbcType="VARCHAR" />
    <result column="reply_msg_type" property="replyMsgType" jdbcType="VARCHAR" />
    <result column="reply_content" property="replyContent" jdbcType="VARCHAR" />
    <result column="reply_media_id" property="replyMediaId" jdbcType="VARCHAR" />
    <result column="reply_title" property="replyTitle" jdbcType="VARCHAR" />
    <result column="reply_description" property="replyDescription" jdbcType="VARCHAR" />
    <result column="reply_pic_url" property="replyPicUrl" jdbcType="VARCHAR" />
    <result column="reply_url" property="replyUrl" jdbcType="VARCHAR" />
    <result column="order_no" property="orderNo" jdbcType="INTEGER" />
    <result column="remark" property="remark"/>
    <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
    <result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
    <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
    <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
    <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
  </resultMap>
  <resultMap type="cn.com.glsx.dj.wechat.dto.WechatReplyConfigDTO" id="DTOResultMap" extends="BaseResultMap">
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    id, wechat_appid, msg_type, content, event, event_key, reply_msg_type, reply_content, 
    reply_media_id, reply_title, reply_description, reply_pic_url, reply_url, order_no, remark,
    created_by, created_date, updated_by, updated_date, deleted_flag
  </sql>
  
  <select id="list" parameterType="cn.com.glsx.dj.wechat.dto.WechatReplyConfigDTO" resultMap="DTOResultMap">
  	select <include refid="Base_Column_List" /> from dj_wechat_reply_config
    <where>
    	deleted_flag = 'N'
    	<if test="id != null">
    		and id = #{id}
    	</if>
    	<if test="wechatAppid != null and wechatAppid !=''">
    		and wechat_appid = #{wechatAppid}
    	</if>
    	<if test="msgType != null and msgType !=''">
    		and msg_type = #{msgType}
    	</if>
    	<if test="content != null and content !=''">
  			and content like CONCAT('%',#{content},'%')
  		</if>
  		<if test="event != null and event !=''">
    		and event = #{event}
    	</if>
    	<if test="replyMsgType != null and replyMsgType !=''">
    		and reply_msg_type = #{replyMsgType}
    	</if>
    </where>
     order by order_no desc
  </select>
  <select id="listMatch" parameterType="cn.com.glsx.dj.wechat.model.WechatReplyConfig" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" /> from dj_wechat_reply_config
    <where>
    	deleted_flag = 'N'
    	and wechat_appid = #{wechatAppid}
    	<choose>
    		<when test="msgType != null and msgType !=''">
    			and msg_type = #{msgType}
    		</when>
    		<otherwise>
    			and msg_type is null
    		</otherwise>
    	</choose>
		<choose>
    		<when test="content != null and content !=''">
    			and content = #{content}
    		</when>
    		<otherwise>
    			and content is null
    		</otherwise>
    	</choose>
    	<choose>
    		<when test="event != null and event !=''">
    			and event = #{event}
    		</when>
    		<otherwise>
    			and event is null
    		</otherwise>
    	</choose>
    	<choose>
    		<when test="eventKey != null and eventKey !=''">
    			and event_key = #{eventKey}
    		</when>
    		<otherwise>
    			and event_key is null
    		</otherwise>
    	</choose>
    </where>
    order by order_no desc
  </select>
</mapper>