Files
foton-slrs-system-rest/adc-da-slrs/src/main/resources/mybatis/mapper/esRevisePlan/EsRevisePlanMapper.xml
T
2021-11-16 09:17:06 +08:00

210 lines
7.7 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.esRevisePlan.dao.EsRevisePlanDao">
<sql id="pages">
<if test=" null != pageSize ">
LIMIT ${(page-1) * pageSize},${pageSize}
</if>
</sql>
<!-- 基础信息-->
<sql id="BaseInfo">
id,
es_name,
plan_status,
revise_status,
drafter,
res_person,
wg_leader,
draft_time,
release_time,
unit
</sql>
<resultMap id="BaseInfoMap" type="com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan">
<id property="id" column="id"></id>
<result property="esName" column="es_name"></result>
<result property="planStatus" column="plan_status"></result>
<result property="reviseStatus" column="revise_status"></result>
<result property="drafter" column="drafter"></result>
<result property="resPerson" column="res_person"></result>
<result property="wgLeader" column="wg_leader"></result>
<result property="draftTime" column="draft_time"></result>
<result property="releaseTime" column="release_time"></result>
<result property="unit" column="unit"></result>
</resultMap>
<!-- 查询条件-->
<sql id="Conditions">
<where>
<if test="esName != null and esName != ''">
and es_name like concat('%',#{esName},'%')
</if>
<if test="planStatus != null and planStatus != ''">
and plan_status = #{planStatus}
</if>
<if test="reviseStatus != null and reviseStatus != ''">
and revise_status = #{reviseStatus}
</if>
<if test="drafter != null and drafter != ''">
and drafter = #{drafter}
</if>
<if test="resPerson != null and resPerson != ''">
and res_person = #{resPerson}
</if>
<if test="wgLeader != null and wgLeader != ''">
and wg_leader = #{wgLeader}
</if>
<if test="draftTime != null">
and DATE_FORMAT(draft_time,'%Y-%m-%d')=DATE_FORMAT(#{draftTime},'%Y-%m-%d')
</if>
<if test="releaseTime != null">
and DATE_FORMAT(release_time,'%Y-%m-%d')=DATE_FORMAT(#{releaseTime},'%Y-%m-%d')
</if>
<if test="unit != null and unit != ''">
and unit like concat('%',#{unit},'%')
</if>
</where>
</sql>
<select id="getTotal" resultType="java.lang.Integer" >
select count(*) from es_revise_plan
</select>
<select id="getQueryTotal" parameterType="com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan" resultType="java.lang.Integer" >
select count(*) from es_revise_plan
<include refid="Conditions"></include>
</select>
<!-- 查询所有-->
<select id="selectAll" resultMap="BaseInfoMap" >
select <include refid="BaseInfo"></include> from es_revise_plan
<include refid="pages">
</include>
</select>
<!-- 多条件查询-->
<select id="queryAll" parameterType="com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan" resultMap="BaseInfoMap">
select <include refid="BaseInfo"></include> from es_revise_plan
<include refid="Conditions">
</include>
<include refid="pages">
</include>
</select>
<!-- 查询详情-->
<select id="selectOne" parameterType="java.lang.String" resultMap="BaseInfoMap">
select <include refid="BaseInfo"></include> from es_revise_plan
where id = #{id}
</select>
<!-- 修改-->
<update id="updateOne" parameterType="com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan">
update es_revise_plan
<set>
<if test="id != null and id != ''">
id = #{id},
</if>
<if test="esName != null and esName != ''">
es_name = #{esName},
</if>
<if test="planStatus != null and planStatus != ''">
plan_status = #{planStatus},
</if>
<if test="reviseStatus != null and reviseStatus != ''">
revise_status = #{reviseStatus},
</if>
<if test="drafter != null and drafter != ''">
drafter = #{drafter},
</if>
<if test="resPerson != null and resPerson != ''">
res_person = #{resPerson},
</if>
<if test="wgLeader != null and wgLeader != ''">
wg_leader = #{wgLeader},
</if>
<if test="draftTime != null">
draft_time = #{draftTime},
</if>
<if test="releaseTime != null">
release_time = #{releaseTime},
</if>
<if test="unit != null and unit != ''">
unit = #{unit},
</if>
</set>
where id = #{id}
</update>
<!-- 插入一条数据-->
<insert id="insertOne" parameterType="com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan">
insert into es_revise_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">
id,
</if>
<if test="esName != null and esName != ''">
es_name,
</if>
<if test="planStatus != null and planStatus != ''">
plan_status,
</if>
<if test="reviseStatus != null and reviseStatus != ''">
revise_status,
</if>
<if test="drafter != null and drafter != ''">
drafter,
</if>
<if test="resPerson != null and resPerson != ''">
res_person,
</if>
<if test="wgLeader != null and wgLeader != ''">
wg_leader,
</if>
<if test="draftTime != null">
draft_time,
</if>
<if test="releaseTime != null">
release_time,
</if>
<if test="unit != null and unit != ''">
unit,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">
#{id},
</if>
<if test="esName != null and esName != ''">
#{esName},
</if>
<if test="planStatus != null and planStatus != ''">
#{planStatus},
</if>
<if test="reviseStatus != null and reviseStatus != ''">
#{reviseStatus},
</if>
<if test="drafter != null and drafter != ''">
#{drafter},
</if>
<if test="resPerson != null and resPerson != ''">
#{resPerson},
</if>
<if test="wgLeader != null and wgLeader != ''">
#{wgLeader},
</if>
<if test="draftTime != null">
#{draftTime},
</if>
<if test="releaseTime != null">
#{releaseTime},
</if>
<if test="unit != null and unit != ''">
#{unit},
</if>
</trim>
</insert>
<!-- 删除-->
<delete id="deleteOne" parameterType="java.lang.String">
delete from es_revise_plan where id = #{id}
</delete>
<!-- 批量删除-->
<delete id="deleteBatch" parameterType="java.lang.String">
delete from es_revise_plan where id in
<foreach collection="array" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</delete>
</mapper>