197 lines
8.0 KiB
XML
197 lines
8.0 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.utArea.dao.UtAreaDao">
|
|
|
|
<!-- Result Map-->
|
|
<resultMap id="BaseResultMap" type="com.adc.da.slrs.utArea.entity.UtArea" >
|
|
<id column="id" property="id" />
|
|
<result column="area_name" property="areaName" />
|
|
<result column="show_index" property="showIndex" />
|
|
<result column="sar_type" property="sarType" />
|
|
<result column="creation_user" property="creationUser" />
|
|
<result column="valid_flag" property="validFlag" />
|
|
<result column="creation_time" property="creationTime" />
|
|
<result column="modify_time" property="modifyTime" />
|
|
</resultMap>
|
|
|
|
<!-- UT_AREA table all fields -->
|
|
<sql id="Base_Column_List" >
|
|
id, area_name, show_index, sar_type, creation_user, valid_flag, creation_time, modify_time
|
|
</sql>
|
|
|
|
<!-- 查询条件 -->
|
|
<sql id="Base_Where_Clause">
|
|
where 1=1
|
|
<trim suffixOverrides="," >
|
|
<if test="id != null" >
|
|
and id ${idOperator} #{id}
|
|
</if>
|
|
<if test="areaName != null" >
|
|
and area_name ${areaNameOperator} #{areaName}
|
|
</if>
|
|
<if test="showIndex != null" >
|
|
and show_index ${showIndexOperator} #{showIndex}
|
|
</if>
|
|
<if test="sarType != null" >
|
|
and sar_type like concat(concat('%',#{sarType}),'%')
|
|
</if>
|
|
<if test="creationUser != null" >
|
|
and creation_user ${creationUserOperator} #{creationUser}
|
|
</if>
|
|
<if test="validFlag != null" >
|
|
and valid_flag ${validFlagOperator} #{validFlag}
|
|
</if>
|
|
<if test="creationTime != null" >
|
|
and creation_time ${creationTimeOperator} #{creationTime}
|
|
</if>
|
|
<if test="creationTime1 != null" >
|
|
and creation_time >= #{creationTime1}
|
|
</if>
|
|
<if test="creationTime2 != null" >
|
|
and creation_time <= #{creationTime2}
|
|
</if>
|
|
<if test="modifyTime != null" >
|
|
and modify_time ${modifyTimeOperator} #{modifyTime}
|
|
</if>
|
|
<if test="modifyTime1 != null" >
|
|
and modify_time >= #{modifyTime1}
|
|
</if>
|
|
<if test="modifyTime2 != null" >
|
|
and modify_time <= #{modifyTime2}
|
|
</if>
|
|
<if test="notId != null" >
|
|
and id != #{notId}
|
|
</if>
|
|
</trim>
|
|
</sql>
|
|
|
|
<!-- 插入记录 -->
|
|
<insert id="insert" parameterType="com.adc.da.slrs.utArea.entity.UtArea" >
|
|
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
|
SELECT SEQ_UT_AREA.NEXTVAL FROM DUAL
|
|
</selectKey> -->
|
|
insert into UT_AREA(<include refid="Base_Column_List" />)
|
|
values (#{id, jdbcType=VARCHAR}, #{areaName, jdbcType=VARCHAR}, #{showIndex, jdbcType=INTEGER}, #{sarType, jdbcType=VARCHAR}, #{creationUser, jdbcType=VARCHAR}, #{validFlag, jdbcType=INTEGER}, #{creationTime, jdbcType=TIMESTAMP}, #{modifyTime, jdbcType=TIMESTAMP})
|
|
</insert>
|
|
|
|
<!-- 动态插入记录 主键是序列 -->
|
|
<insert id="insertSelective" parameterType="com.adc.da.slrs.utArea.entity.UtArea" >
|
|
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
|
SELECT SEQ_UT_AREA.NEXTVAL FROM DUAL
|
|
</selectKey> -->
|
|
insert into UT_AREA
|
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
|
<if test="id != null" >id,</if>
|
|
<if test="areaName != null" >area_name,</if>
|
|
<if test="showIndex != null" >show_index,</if>
|
|
<if test="sarType != null" >sar_type,</if>
|
|
<if test="creationUser != null" >creation_user,</if>
|
|
<if test="validFlag != null" >valid_flag,</if>
|
|
<if test="creationTime != null" >creation_time,</if>
|
|
<if test="modifyTime != null" >modify_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
|
|
<if test="areaName != null" >#{areaName, jdbcType=VARCHAR},</if>
|
|
<if test="showIndex != null" >#{showIndex, jdbcType=INTEGER},</if>
|
|
<if test="sarType != null" >#{sarType, jdbcType=VARCHAR},</if>
|
|
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
|
|
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
|
|
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
|
|
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<!-- 根据pk,修改记录-->
|
|
<update id="updateByPrimaryKey" parameterType="com.adc.da.slrs.utArea.entity.UtArea" >
|
|
update UT_AREA
|
|
set area_name = #{areaName},
|
|
show_index = #{showIndex},
|
|
sar_type = #{sarType},
|
|
creation_user = #{creationUser},
|
|
valid_flag = #{validFlag},
|
|
creation_time = #{creationTime},
|
|
modify_time = #{modifyTime}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!-- 修改记录,只修改只不为空的字段 -->
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.slrs.utArea.entity.UtArea" >
|
|
update UT_AREA
|
|
<set >
|
|
<if test="areaName != null" >
|
|
area_name = #{areaName},
|
|
</if>
|
|
<if test="showIndex != null" >
|
|
show_index = #{showIndex},
|
|
</if>
|
|
<if test="sarType != null" >
|
|
sar_type = #{sarType},
|
|
</if>
|
|
<if test="creationUser != null" >
|
|
creation_user = #{creationUser},
|
|
</if>
|
|
<if test="validFlag != null" >
|
|
valid_flag = #{validFlag},
|
|
</if>
|
|
<if test="creationTime != null" >
|
|
creation_time = #{creationTime},
|
|
</if>
|
|
<if test="modifyTime != null" >
|
|
modify_time = #{modifyTime},
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!-- 根据id查询 UT_AREA -->
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
|
|
select <include refid="Base_Column_List" />
|
|
from UT_AREA
|
|
where id = #{value}
|
|
|
|
</select>
|
|
|
|
<!-- 删除记录 -->
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
delete from UT_AREA
|
|
where id = #{value}
|
|
|
|
</delete>
|
|
|
|
<!-- UT_AREA 列表总数-->
|
|
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
|
|
select count(1) from UT_AREA
|
|
<include refid="Base_Where_Clause"/>
|
|
</select>
|
|
|
|
<!-- 查询UT_AREA列表 -->
|
|
<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 UT_AREA
|
|
<include refid="Base_Where_Clause"/>
|
|
order by show_index,id
|
|
) 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"/> from UT_AREA
|
|
<include refid="Base_Where_Clause"/>
|
|
order by show_index,id
|
|
</select>
|
|
|
|
<select id="getAreaSelList" parameterType="com.adc.da.slrs.utArea.entity.UtArea" resultType="com.adc.da.sys.common.SelectionResult">
|
|
select id as value,area_name as label
|
|
from UT_AREA
|
|
where 1=1
|
|
<if test="id != null" >
|
|
and id != #{id}
|
|
</if>
|
|
<if test="sarType != null" >
|
|
and sar_type like concat(concat('%',#{sarType}),'%')
|
|
</if>
|
|
order by show_index,id
|
|
</select>
|
|
</mapper>
|