|
|
@@ -0,0 +1,250 @@
|
|
|
+<?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.xunmei.core.safetybook.mapper.CoreSafetyBookNewMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.xunmei.core.safetybook.domain.CoreSafetyBookNew" id="CoreSafetyBookNewResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="year" column="year"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="deleted" column="deleted"/>
|
|
|
+ <result property="type" column="type"/>
|
|
|
+ <result property="time" column="time"/>
|
|
|
+ <result property="partyA" column="party_a"/>
|
|
|
+ <result property="partyB" column="party_b"/>
|
|
|
+ <result property="partyAOrg" column="party_a_org"/>
|
|
|
+ <result property="partyBOrg" column="party_b_org"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectCoreSafetyBookNewVo">
|
|
|
+ select id,
|
|
|
+ year,
|
|
|
+ create_by,
|
|
|
+ create_time,
|
|
|
+ update_by,
|
|
|
+ update_time,
|
|
|
+ deleted,
|
|
|
+ type,
|
|
|
+ time,
|
|
|
+ party_a,
|
|
|
+ party_b,
|
|
|
+ party_a_org,
|
|
|
+ party_b_org
|
|
|
+ from core_safety_book_new
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectCoreSafetyBookNewList" parameterType="com.xunmei.core.safetybook.domain.CoreSafetyBookNew"
|
|
|
+ resultMap="CoreSafetyBookNewResult">
|
|
|
+ <include refid="selectCoreSafetyBookNewVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="year != null ">
|
|
|
+ and year = #{year}
|
|
|
+ </if>
|
|
|
+ <if test="deleted != null ">
|
|
|
+ and deleted = #{deleted}
|
|
|
+ </if>
|
|
|
+ <if test="type != null ">
|
|
|
+ and type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="time != null ">
|
|
|
+ and time = #{time}
|
|
|
+ </if>
|
|
|
+ <if test="partyA != null and partyA != ''">
|
|
|
+ and party_a = #{partyA}
|
|
|
+ </if>
|
|
|
+ <if test="partyB != null and partyB != ''">
|
|
|
+ and party_b = #{partyB}
|
|
|
+ </if>
|
|
|
+ <if test="partyAOrg != null and partyAOrg != ''">
|
|
|
+ and party_a_org = #{partyAOrg}
|
|
|
+ </if>
|
|
|
+ <if test="partyBOrg != null and partyBOrg != ''">
|
|
|
+ and party_b_org = #{partyBOrg}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCoreSafetyBookNewById" parameterType="Long"
|
|
|
+ resultMap="CoreSafetyBookNewResult">
|
|
|
+ <include refid="selectCoreSafetyBookNewVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+ <select id="selectSafetyBookNewPage" resultType="com.xunmei.core.safetybook.domain.CoreSafetyBookNew">
|
|
|
+ select b.id,
|
|
|
+ b.year,
|
|
|
+ b.create_by,
|
|
|
+ b.create_time,
|
|
|
+ b.update_by,
|
|
|
+ b.sign_level,
|
|
|
+ b.time,
|
|
|
+ b.update_time,
|
|
|
+ b.deleted,
|
|
|
+ b.type,
|
|
|
+ b.party_b_org,
|
|
|
+ b.party_b,
|
|
|
+ b.party_a_org,b.party_a,
|
|
|
+ u.name as user_name,
|
|
|
+ o.short_name as partyBOrgName
|
|
|
+ from core_safety_book_new b
|
|
|
+ left join sys_user u on b.create_by=u.id
|
|
|
+ left join sys_org o on o.id=b.party_b_org
|
|
|
+ where b.deleted = 0
|
|
|
+ <if test="info.year != null">
|
|
|
+ and b.year=#{info.year}
|
|
|
+ </if>
|
|
|
+ <if test="info.type != null">
|
|
|
+ and b.type=#{info.type}
|
|
|
+ </if>
|
|
|
+ <if test="info.type != null">
|
|
|
+ and b.type=#{info.type}
|
|
|
+ </if>
|
|
|
+ <if test="info.checkSub ==true">
|
|
|
+ and o.path like concat(#{info.selectOrgPath},'%')
|
|
|
+ </if>
|
|
|
+ <if test="info.checkSub ==false">
|
|
|
+ and o.path = #{info.selectOrgPath}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="selectSafetyBookById" resultType="com.xunmei.core.safetybook.domain.CoreSafetyBookNew">
|
|
|
+ select b.id,
|
|
|
+ b.year,
|
|
|
+ b.create_by,
|
|
|
+ b.create_time,
|
|
|
+ b.update_by,
|
|
|
+ b.update_time,
|
|
|
+ b.deleted,
|
|
|
+ b.sign_level,
|
|
|
+ b.time,
|
|
|
+ b.type,
|
|
|
+ b.party_b_org,
|
|
|
+ b.party_b,
|
|
|
+ b.party_a_org,
|
|
|
+ b.party_a,
|
|
|
+ u.name as user_name,
|
|
|
+ o.short_name as partyBOrgName
|
|
|
+ from core_safety_book_new b
|
|
|
+ left join sys_user u on b.create_by = u.id
|
|
|
+ left join sys_org o on o.id = b.party_b_org
|
|
|
+ where b.deleted = 0
|
|
|
+ and b.id = #{id}
|
|
|
+
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertCoreSafetyBookNew" parameterType="com.xunmei.core.safetybook.domain.CoreSafetyBookNew"
|
|
|
+ useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into core_safety_book_new
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="year != null">year,
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">create_by,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">create_time,
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">update_by,
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">update_time,
|
|
|
+ </if>
|
|
|
+ <if test="deleted != null">deleted,
|
|
|
+ </if>
|
|
|
+ <if test="type != null">type,
|
|
|
+ </if>
|
|
|
+ <if test="time != null">time,
|
|
|
+ </if>
|
|
|
+ <if test="partyA != null">party_a,
|
|
|
+ </if>
|
|
|
+ <if test="partyB != null">party_b,
|
|
|
+ </if>
|
|
|
+ <if test="partyAOrg != null">party_a_org,
|
|
|
+ </if>
|
|
|
+ <if test="partyBOrg != null">party_b_org,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="year != null">#{year},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">#{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">#{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">#{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">#{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="deleted != null">#{deleted},
|
|
|
+ </if>
|
|
|
+ <if test="type != null">#{type},
|
|
|
+ </if>
|
|
|
+ <if test="time != null">#{time},
|
|
|
+ </if>
|
|
|
+ <if test="partyA != null">#{partyA},
|
|
|
+ </if>
|
|
|
+ <if test="partyB != null">#{partyB},
|
|
|
+ </if>
|
|
|
+ <if test="partyAOrg != null">#{partyAOrg},
|
|
|
+ </if>
|
|
|
+ <if test="partyBOrg != null">#{partyBOrg},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateCoreSafetyBookNew" parameterType="com.xunmei.core.safetybook.domain.CoreSafetyBookNew">
|
|
|
+ update core_safety_book_new
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="year != null">year =
|
|
|
+ #{year},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">create_by =
|
|
|
+ #{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">create_time =
|
|
|
+ #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">update_by =
|
|
|
+ #{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">update_time =
|
|
|
+ #{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="deleted != null">deleted =
|
|
|
+ #{deleted},
|
|
|
+ </if>
|
|
|
+ <if test="type != null">type =
|
|
|
+ #{type},
|
|
|
+ </if>
|
|
|
+ <if test="time != null">time =
|
|
|
+ #{time},
|
|
|
+ </if>
|
|
|
+ <if test="partyA != null">party_a =
|
|
|
+ #{partyA},
|
|
|
+ </if>
|
|
|
+ <if test="partyB != null">party_b =
|
|
|
+ #{partyB},
|
|
|
+ </if>
|
|
|
+ <if test="partyAOrg != null">party_a_org =
|
|
|
+ #{partyAOrg},
|
|
|
+ </if>
|
|
|
+ <if test="partyBOrg != null">party_b_org =
|
|
|
+ #{partyBOrg},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteCoreSafetyBookNewById" parameterType="Long">
|
|
|
+ delete
|
|
|
+ from core_safety_book_new
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteCoreSafetyBookNewByIds" parameterType="String">
|
|
|
+ delete from core_safety_book_new where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|