|
@@ -0,0 +1,119 @@
|
|
|
+<?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.sooka.apply.mapper.IntRecordMapper">
|
|
|
+
|
|
|
+ <resultMap type="IntRecord" id="IntRecordResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="applyOid" column="apply_oid" />
|
|
|
+ <result property="applyName" column="apply_name" />
|
|
|
+ <result property="orgId" column="org_id" />
|
|
|
+ <result property="orgName" column="org_name" />
|
|
|
+ <result property="applyTime" column="apply_time" />
|
|
|
+ <result property="intNumbers" column="int_numbers" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="IntRecordIntDetailedResult" type="IntRecord" extends="IntRecordResult">
|
|
|
+ <collection property="intDetailedList" notNullColumn="id" javaType="java.util.List" resultMap="IntDetailedResult" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="IntDetailed" id="IntDetailedResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="recordId" column="record_id" />
|
|
|
+ <result property="intId" column="int_id" />
|
|
|
+ <result property="strAt" column="str_at" />
|
|
|
+ <result property="endAt" column="end_at" />
|
|
|
+ <result property="secretKey" column="secret_key" />
|
|
|
+ <result property="status" column="status" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectIntRecordVo">
|
|
|
+ SELECT
|
|
|
+ i.id,
|
|
|
+ i.apply_oid,
|
|
|
+ d1.dept_name apply_name,
|
|
|
+ i.org_id,
|
|
|
+ d2.dept_name org_name,
|
|
|
+ i.apply_time,
|
|
|
+ i.int_numbers
|
|
|
+ FROM
|
|
|
+ int_record i,
|
|
|
+ sys_dept d1,
|
|
|
+ sys_dept d2
|
|
|
+ WHERE
|
|
|
+ d1.dept_id = i.apply_oid
|
|
|
+ AND d2.dept_id = i.org_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectIntRecordList" parameterType="IntRecord" resultMap="IntRecordResult">
|
|
|
+ <include refid="selectIntRecordVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="applyOid != null "> and apply_oid = #{applyOid}</if>
|
|
|
+ <if test="orgId != null "> and org_id = #{orgId}</if>
|
|
|
+ <if test="applyTime != null "> and apply_time = #{applyTime}</if>
|
|
|
+ <if test="intNumbers != null "> and int_numbers = #{intNumbers}</if>
|
|
|
+ </where>
|
|
|
+ ORDER BY i.apply_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectIntRecordById" parameterType="String" resultMap="IntRecordIntDetailedResult">
|
|
|
+ select a.id, a.apply_oid, a.org_id, a.apply_time, a.int_numbers,
|
|
|
+ b.id, b.record_id, b.int_id, b.str_at, b.end_at, b.secret_key, b.status
|
|
|
+ from int_record a
|
|
|
+ left join int_detailed b on b.record_id = a.id
|
|
|
+ where a.id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertIntRecord" parameterType="IntRecord">
|
|
|
+ insert into int_record
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">id,</if>
|
|
|
+ <if test="applyOid != null">apply_oid,</if>
|
|
|
+ <if test="orgId != null">org_id,</if>
|
|
|
+ <if test="applyTime != null">apply_time,</if>
|
|
|
+ <if test="intNumbers != null">int_numbers,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="applyOid != null">#{applyOid},</if>
|
|
|
+ <if test="orgId != null">#{orgId},</if>
|
|
|
+ <if test="applyTime != null">#{applyTime},</if>
|
|
|
+ <if test="intNumbers != null">#{intNumbers},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="aa" parameterType="IntDetailed">
|
|
|
+
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="changeStatus" parameterType="IntDetailed">
|
|
|
+ update int_detailed
|
|
|
+ <set>
|
|
|
+ <if test="status != null and status != ''">status = #{status},</if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteIntRecordByIds" parameterType="String">
|
|
|
+ delete from int_record where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteIntDetailedByRecordIds" parameterType="String">
|
|
|
+ delete from int_detailed where record_id in
|
|
|
+ <foreach item="recordId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{recordId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <insert id="batchIntDetailed">
|
|
|
+ insert into int_detailed( id, record_id, int_id, str_at, end_at, secret_key, status) values
|
|
|
+ <foreach item="item" index="index" collection="list" separator=",">
|
|
|
+ ( #{item.id}, #{item.recordId}, #{item.intId}, #{item.strAt}, #{item.endAt}, #{item.secretKey}, #{item.status})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+</mapper>
|