transferServiceJavaSqlite/src/main/resources/mapper/MessageConfigDao.xml

197 lines
6.4 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.jepsoninfo.dao.MessageConfigDao">
<resultMap type="com.jepsoninfo.entity.MessageConfig" id="BaseResultMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="cnName" column="cn_name" jdbcType="VARCHAR"/>
<result property="content" column="content" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="BaseResultMapEx" extends="BaseResultMap" type="com.jepsoninfo.entity.ex.MessageConfigEx">
</resultMap>
<sql id="Base_Column_List">
id
, cn_name, content, create_time, update_time </sql>
<select id="selectByCond" resultMap="BaseResultMapEx">
select
<include refid="Base_Column_List"/>
from message_config
<where>
1=1
<if test="cond.id != null">
and id = #{cond.id}
</if>
<if test="cond.cnName != null and cond.cnName != ''">
and cn_name = #{cond.cnName}
</if>
<if test="cond.content != null and cond.content != ''">
and content = #{cond.content}
</if>
<if test="cond.createTime != null">
and create_time = #{cond.createTime}
</if>
<if test="cond.updateTime != null">
and update_time = #{cond.updateTime}
</if>
</where>
</select>
<select id="selectListByCond" resultMap="BaseResultMapEx">
select
<include refid="Base_Column_List"/>
from message_config
<where>
1=1
<if test="cond.id != null">
and id = #{cond.id}
</if>
<if test="cond.cnName != null and cond.cnName != ''">
and cn_name = #{cond.cnName}
</if>
<if test="cond.content != null and cond.content != ''">
and content = #{cond.content}
</if>
<if test="cond.createTime != null">
and create_time = #{cond.createTime}
</if>
<if test="cond.updateTime != null">
and update_time = #{cond.updateTime}
</if>
<if test="cond.startCreateTime != null">
and create_time &gt;= #{cond.startCreateTime}
</if>
<if test="cond.endCreateTime != null">
and create_time &lt;= #{cond.endCreateTime}
</if>
<if test="cond.startUpdateTime != null">
and update_time &gt;= #{cond.startUpdateTime}
</if>
<if test="cond.endUpdateTime != null">
and update_time &lt;= #{cond.endUpdateTime}
</if>
</where>
order by update_time desc
</select>
<!--查询单个-->
<select id="selectByPrimaryKey" resultMap="BaseResultMapEx">
select
<include refid="Base_Column_List"/>
from message_config
where id = #{id}
</select>
<!--统计总行数-->
<select id="selectCountByCond" resultType="java.lang.Long">
select count(1)
from message_config
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="cnName != null and cnName != ''">
and cn_name = #{cnName}
</if>
<if test="content != null and content != ''">
and content = #{content}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
</where>
</select>
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into message_config(id, cn_name, content, create_time, update_time)
values (#{id}, #{cnName}, #{content}, #{createTime}, #{updateTime})
</insert>
<insert id="insertSelective" keyProperty="id" useGeneratedKeys="true">
insert into message_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="cnName != null">
cn_name,
</if>
<if test="content != null">
content,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="cnName != null">
#{cnName},
</if>
<if test="content != null">
#{content},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<update id="updateByPrimaryKey">
update message_config
<set>
id = #{id},
cn_name = #{cnName},
content = #{content},
create_time = #{createTime},
update_time = #{updateTime},
</set>
where id = #{id}
</update>
<update id="updateByPrimaryKeySelective">
update message_config
<set>
<if test="id != null">
id = #{id},
</if>
<if test="cnName != null and cnName != ''">
cn_name = #{cnName},
</if>
<if test="content != null and content != ''">
content = #{content},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteByPrimaryKey">
delete
from message_config
where id = #{id}
</delete>
</mapper>