|
|
@@ -0,0 +1,186 @@
|
|
|
+<?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.goafanti.common.dao.StandardDocumentMapper">
|
|
|
+
|
|
|
+ <resultMap id="BaseResultMap" type="com.goafanti.common.model.StandardDocument">
|
|
|
+ <id property="id" column="id" jdbcType="INTEGER"/>
|
|
|
+ <result property="url" column="url" jdbcType="VARCHAR"/>
|
|
|
+ <result property="serialNumber" column="serial_number" jdbcType="VARCHAR"/>
|
|
|
+ <result property="name" column="name" jdbcType="VARCHAR"/>
|
|
|
+ <result property="reference" column="reference" jdbcType="VARCHAR"/>
|
|
|
+ <result property="depId" column="dep_id" jdbcType="VARCHAR"/>
|
|
|
+ <result property="aid" column="aid" jdbcType="VARCHAR"/>
|
|
|
+ <result property="status" column="status" jdbcType="INTEGER"/>
|
|
|
+ <result property="type" column="type" jdbcType="INTEGER"/>
|
|
|
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
|
+ <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id,url,serial_number,
|
|
|
+ name,reference,dep_id,
|
|
|
+ aid,status,type,
|
|
|
+ create_time,update_time
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from standard_document
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
|
|
+ delete from standard_document
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.StandardDocument" useGeneratedKeys="true">
|
|
|
+ insert into standard_document
|
|
|
+ ( id,url,serial_number
|
|
|
+ ,name,reference,dep_id
|
|
|
+ ,aid,status,type
|
|
|
+ ,create_time,update_time)
|
|
|
+ values (#{id,jdbcType=INTEGER},#{url,jdbcType=VARCHAR},#{serialNumber,jdbcType=VARCHAR}
|
|
|
+ ,#{name,jdbcType=VARCHAR},#{reference,jdbcType=VARCHAR},#{depId,jdbcType=VARCHAR}
|
|
|
+ ,#{aid,jdbcType=VARCHAR},#{status,jdbcType=INTEGER},#{type,jdbcType=INTEGER}
|
|
|
+ ,#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
|
|
|
+ </insert>
|
|
|
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.StandardDocument" useGeneratedKeys="true">
|
|
|
+ insert into standard_document
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">id,</if>
|
|
|
+ <if test="url != null">url,</if>
|
|
|
+ <if test="serialNumber != null">serial_number,</if>
|
|
|
+ <if test="name != null">name,</if>
|
|
|
+ <if test="reference != null">reference,</if>
|
|
|
+ <if test="depId != null">dep_id,</if>
|
|
|
+ <if test="aid != null">aid,</if>
|
|
|
+ <if test="status != null">status,</if>
|
|
|
+ <if test="type != null">type,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id,jdbcType=INTEGER},</if>
|
|
|
+ <if test="url != null">#{url,jdbcType=VARCHAR},</if>
|
|
|
+ <if test="serialNumber != null">#{serialNumber,jdbcType=VARCHAR},</if>
|
|
|
+ <if test="name != null">#{name,jdbcType=VARCHAR},</if>
|
|
|
+ <if test="reference != null">#{reference,jdbcType=VARCHAR},</if>
|
|
|
+ <if test="depId != null">#{depId,jdbcType=VARCHAR},</if>
|
|
|
+ <if test="aid != null">#{aid,jdbcType=VARCHAR},</if>
|
|
|
+ <if test="status != null">#{status,jdbcType=INTEGER},</if>
|
|
|
+ <if test="type != null">#{type,jdbcType=INTEGER},</if>
|
|
|
+ <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.StandardDocument">
|
|
|
+ update standard_document
|
|
|
+ <set>
|
|
|
+ <if test="url != null">
|
|
|
+ url = #{url,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="serialNumber != null">
|
|
|
+ serial_number = #{serialNumber,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ name = #{name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="reference != null">
|
|
|
+ reference = #{reference,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="depId != null">
|
|
|
+ dep_id = #{depId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="aid != null">
|
|
|
+ aid = #{aid,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ status = #{status,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="type != null">
|
|
|
+ type = #{type,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+ <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.StandardDocument">
|
|
|
+ update standard_document
|
|
|
+ set
|
|
|
+ url = #{url,jdbcType=VARCHAR},
|
|
|
+ serial_number = #{serialNumber,jdbcType=VARCHAR},
|
|
|
+ name = #{name,jdbcType=VARCHAR},
|
|
|
+ reference = #{reference,jdbcType=VARCHAR},
|
|
|
+ dep_id = #{depId,jdbcType=VARCHAR},
|
|
|
+ aid = #{aid,jdbcType=VARCHAR},
|
|
|
+ status = #{status,jdbcType=INTEGER},
|
|
|
+ type = #{type,jdbcType=INTEGER},
|
|
|
+ create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ update_time = #{updateTime,jdbcType=TIMESTAMP}
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <resultMap id="DetailsMap" type="com.goafanti.standard.bo.OutStandardDocument">
|
|
|
+ <id property="id" column="id" jdbcType="INTEGER"/>
|
|
|
+ <result property="url" column="url" jdbcType="VARCHAR"/>
|
|
|
+ <result property="serialNumber" column="serial_number" jdbcType="VARCHAR"/>
|
|
|
+ <result property="name" column="name" jdbcType="VARCHAR"/>
|
|
|
+ <result property="reference" column="reference" jdbcType="VARCHAR"/>
|
|
|
+ <result property="depId" column="dep_id" jdbcType="VARCHAR"/>
|
|
|
+ <result property="aid" column="aid" jdbcType="VARCHAR"/>
|
|
|
+ <result property="type" column="type" jdbcType="INTEGER"/>
|
|
|
+ <result property="status" column="status" jdbcType="INTEGER"/>
|
|
|
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
|
+ <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
|
|
+ <result property="adminName" column="adminName" jdbcType="VARCHAR"/>
|
|
|
+ <result property="depName" column="depName" jdbcType="VARCHAR"/>
|
|
|
+ </resultMap>
|
|
|
+ <select id="selectDetailsById" resultMap="DetailsMap">
|
|
|
+ select
|
|
|
+ a.*,b.name adminName,c.name depName
|
|
|
+ from standard_document a left join admin b on a.aid=b.id
|
|
|
+ left join department c on a.dep_id=c.id
|
|
|
+ where a.id = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+ <select id="standardList" resultMap="DetailsMap">
|
|
|
+ select
|
|
|
+ a.*,b.name adminName,c.name depName
|
|
|
+ from standard_document a left join admin b on a.aid=b.id
|
|
|
+ left join department c on a.dep_id=c.id
|
|
|
+ where 1=1
|
|
|
+ <include refid="standardSql"/>
|
|
|
+ </select>
|
|
|
+ <sql id="standardSql">
|
|
|
+ <if test="status !=null">
|
|
|
+ and a.status = #{status,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="startTime !=null and endTime !=null">
|
|
|
+ and a.update_time between #{startTime,jdbcType=TIMESTAMP} and #{endTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="depId !=null">
|
|
|
+ and a.dep_id = #{depId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="name !=null">
|
|
|
+ and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="standardCount" resultType="java.lang.Integer">
|
|
|
+ select
|
|
|
+ count(*)
|
|
|
+ from standard_document a
|
|
|
+ where 1=1
|
|
|
+ <include refid="standardSql"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+</mapper>
|