net.mingsoft.msend.dao.ILogDao.xml Maven / Gradle / Ivy
<?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="net.mingsoft.msend.dao.ILogDao"> <resultMap id="resultMap" type="net.mingsoft.msend.entity.LogEntity"> <id column="log_id" property="logId" /><!-- --> <result column="app_id" property="appId" /><!--应用编号 --> <result column="log_datetime" property="logDatetime" /><!--时间 --> <result column="log_content" property="logContent" /><!--接收内容 --> <result column="log_receive" property="logReceive" /><!--接收人 --> <result column="log_type" property="logType" /><!--日志类型0邮件1短信 --> </resultMap> <!--保存--> <insert id="saveEntity" useGeneratedKeys="true" keyProperty="logId" parameterType="net.mingsoft.msend.entity.LogEntity" > insert into msend_log <trim prefix="(" suffix=")" suffixOverrides=","> <if test="appId != null">app_id,</if> <if test="logDatetime != null">log_datetime,</if> <if test="logContent != null and logContent != ''">log_content,</if> <if test="logReceive != null and logReceive != ''">log_receive,</if> <if test="logType != null">log_type,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="appId != null">#{appId},</if> <if test="logDatetime != null">#{logDatetime},</if> <if test="logContent != null and logContent != ''">#{logContent},</if> <if test="logReceive != null and logReceive != ''">#{logReceive},</if> <if test="logType != null">#{logType},</if> </trim> </insert> <!--更新--> <update id="updateEntity" parameterType="net.mingsoft.msend.entity.LogEntity"> update msend_log <set> <if test="appId != null">app_id=#{appId},</if> <if test="logDatetime != null">log_datetime=#{logDatetime},</if> <if test="logContent != null and logContent != ''">log_content=#{logContent},</if> <if test="logReceive != null and logReceive != ''">log_receive=#{logReceive},</if> <if test="logType != null">log_type=#{logType},</if> </set> where log_id = #{logId} </update> <!--根据id获取--> <select id="getEntity" resultMap="resultMap" parameterType="int"> select * from msend_log where log_id=#{logId} </select> <!--根据实体获取--> <select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.msend.entity.LogEntity"> select * from msend_log <where> <if test="appId != null"> and app_id=#{appId} </if> <if test="logDatetime != null"> and log_datetime=#{logDatetime} </if> <if test="logContent != null and logContent != ''"> and log_content=#{logContent} </if> <if test="logReceive != null and logReceive != ''"> and log_receive=#{logReceive} </if> <if test="logType != null"> and log_type=#{logType} </if> </where> limit 0,1 </select> <!--删除--> <delete id="deleteEntity" parameterType="int"> delete from msend_log where log_id=#{logId} </delete> <!--批量删除--> <delete id="delete" > delete from msend_log <where> log_id in <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">#{item}</foreach> </where> </delete> <!--查询全部--> <select id="queryAll" resultMap="resultMap"> select * from msend_log order by log_id desc </select> <!--条件查询--> <select id="query" resultMap="resultMap"> select * from msend_log <where> <if test="appId != null"> and app_id=#{appId} </if> <if test="logDatetime != null"> and log_datetime=#{logDatetime} </if> <if test="logContent != null and logContent != ''"> and log_content=#{logContent} </if> <if test="logReceive != null and logReceive != ''"> and log_receive like CONCAT('%',#{logReceive},'%')</if> <if test="logType != null"> and log_type=#{logType} </if> </where> order by log_id desc </select> </mapper>