Files
foton-slrs-system-rest/adc-da-slrs/src/main/resources/mybatis/mapper/SarUpdLog/SarUpdLogMapper.xml
T

156 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.adc.da.slrs.sarUpdLog.dao.SarUpdLogDao">
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.slrs.sarUpdLog.entity.SarUpdLog" >
<id column="id" property="id" />
<result column="sar_type" property="sarType" />
<result column="sar_id" property="sarId" />
<result column="content" property="content" />
<result column="creation_time" property="creationTime" />
<result column="creation_user" property="creationUser" />
<result column="creationUserName" property="creationUserName" />
</resultMap>
<!-- SAR_UPD_LOG table all fields -->
<sql id="Base_Column_List" >
SAR_UPD_LOG.id, sar_type, sar_id, content, SAR_UPD_LOG.creation_time,SAR_UPD_LOG.creation_user
</sql>
<!-- 查询条件 -->
<sql id="Base_Where_Clause">
where 1=1
<trim suffixOverrides="," >
<if test="id != null" >
and id ${idOperator} #{id}
</if>
<if test="sarType != null" >
and sar_type ${sarTypeOperator} #{sarType}
</if>
<if test="sarId != null" >
and sar_id ${sarIdOperator} #{sarId}
</if>
<if test="content != null" >
and content ${contentOperator} #{content}
</if>
<if test="creationTime != null" >
and creation_time ${creationTimeOperator} #{creationTime}
</if>
<if test="creationTime1 != null" >
and creation_time &gt;= #{creationTime1}
</if>
<if test="creationTime2 != null" >
and creation_time &lt;= #{creationTime2}
</if>
</trim>
</sql>
<!-- 插入记录 -->
<insert id="insert" parameterType="com.adc.da.slrs.sarUpdLog.entity.SarUpdLog" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_SAR_UPD_LOG.NEXTVAL FROM DUAL
</selectKey> -->
insert into SAR_UPD_LOG(<include refid="Base_Column_List" />)
values (#{id, jdbcType=VARCHAR}, #{sarType, jdbcType=VARCHAR}, #{sarId, jdbcType=VARCHAR}, #{content, jdbcType=CLOB}, #{creationTime, jdbcType=TIMESTAMP})
</insert>
<!-- 动态插入记录 主键是序列 -->
<insert id="insertSelective" parameterType="com.adc.da.slrs.sarUpdLog.entity.SarUpdLog" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_SAR_UPD_LOG.NEXTVAL FROM DUAL
</selectKey> -->
insert into SAR_UPD_LOG
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >id,</if>
<if test="sarType != null" >sar_type,</if>
<if test="sarId != null" >sar_id,</if>
<if test="content != null" >content,</if>
<if test="creationTime != null" >creation_time,</if>
<if test="creationUser != null" >creation_user,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
<if test="sarType != null" >#{sarType, jdbcType=VARCHAR},</if>
<if test="sarId != null" >#{sarId, jdbcType=VARCHAR},</if>
<if test="content != null" >#{content, jdbcType=CLOB},</if>
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
</trim>
</insert>
<!-- 根据pk,修改记录-->
<update id="updateByPrimaryKey" parameterType="com.adc.da.slrs.sarUpdLog.entity.SarUpdLog" >
update SAR_UPD_LOG
set sar_type = #{sarType},
sar_id = #{sarId},
content = #{content},
creation_time = #{creationTime}
where id = #{id}
</update>
<!-- 修改记录,只修改只不为空的字段 -->
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.slrs.sarUpdLog.entity.SarUpdLog" >
update SAR_UPD_LOG
<set >
<if test="sarType != null" >
sar_type = #{sarType},
</if>
<if test="sarId != null" >
sar_id = #{sarId},
</if>
<if test="content != null" >
content = #{content},
</if>
<if test="creationTime != null" >
creation_time = #{creationTime},
</if>
<if test="creationUser != null" >
creation_user = #{creationUser},
</if>
</set>
where id = #{id}
</update>
<!-- 根据id查询 SAR_UPD_LOG -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_UPD_LOG
where id = #{value}
</select>
<!-- 删除记录 -->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from SAR_UPD_LOG
where id = #{value}
</delete>
<!-- SAR_UPD_LOG 列表总数-->
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
select count(1) from SAR_UPD_LOG
<include refid="Base_Where_Clause"/>
</select>
<!-- 查询SAR_UPD_LOG列表 -->
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List" /> from
(select tmp_tb.* from
(select <include refid="Base_Column_List" /> from SAR_UPD_LOG
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
) tmp_tb limit ${pager.startIndex-1},${pageSize}) a
</select>
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List"/>,TS_USER.uname as creationUserName from SAR_UPD_LOG
left join TS_USER on SAR_UPD_LOG.creation_user = TS_USER.usid
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
</select>
</mapper>