<?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.timer.api.dao.admin.AdminMsgTemplateMapper"> <resultMap id="BaseResultMap" type="cn.timer.api.bean.admin.AdminMsgTemplate" > <id column="id" property="id" /> <result column="template_name" property="templateName" /> <result column="platform_num" property="platformNum" /> <result column="platform_type" property="platformType" /> <result column="content" property="content" /> <result column="msg_type" property="msgType" /> <result column="state" property="state" /> <result column="addtime" property="addtime" /> <result column="org_code" property="orgCode" /> </resultMap> <sql id="Base_Column_List"> id, template_name, platform_num, platform_type, content, msg_type, state, addtime, org_code </sql> <select id="listMsgTemplate" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM admin_msg_template temp <where> <if test="param.templateName != null and param.templateName !=''"> and temp.template_name like CONCAT('%',#{param.templateName},'%') </if> <if test="param.platformType != null"> and temp.platform_type = #{param.platformType} </if> <if test="param.msgType != null"> and temp.msg_type = #{param.msgType} </if> <if test="param.state != null"> and temp.state = #{param.state} </if> <if test="param.orgCode != null"> and temp.org_code = #{param.orgCode} </if> </where> </select> <!-- 分页查询 --> <sql id="pageMsgTemplateCondition"> <where> <if test="param.templateName != null and param.templateName !=''"> and temp.template_name like CONCAT('%',#{param.templateName},'%') </if> <if test="param.platformType != null"> and temp.platform_type = #{param.platformType} </if> <if test="param.msgType != null"> and temp.msg_type = #{param.msgType} </if> <if test="param.state != null"> and temp.state = #{param.state} </if> <if test="param.orgCode != null"> and temp.org_code = #{param.orgCode} </if> </where> </sql> <select id="pageMsgTemplateCount" resultType="java.lang.Long"> SELECT count(*) FROM admin_msg_template temp <include refid="pageMsgTemplateCondition" /> </select> <select id="pageMsgTemplate" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM admin_msg_template temp <include refid="pageMsgTemplateCondition" /> LIMIT #{param.offset}, #{param.totalPage} </select> </mapper>