|
@@ -1,84 +1,94 @@
|
|
|
<?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.ym.mec.biz.dal.dao.InspectionItemDao">
|
|
|
- <resultMap id="InspectionItem" type="com.ym.mec.biz.dal.entity.InspectionItem">
|
|
|
- <!--@mbg.generated-->
|
|
|
- <!--@Table inspection_item-->
|
|
|
- <id column="id_" property="id" />
|
|
|
- <result column="inspection_id_" property="inspectionId" />
|
|
|
- <result column="organ_id_" property="organId" />
|
|
|
- <result column="user_id_" property="userId" />
|
|
|
- <result column="item_" property="item" />
|
|
|
- <result column="times_" property="times" />
|
|
|
- <result column="planned_times_" property="plannedTimes" />
|
|
|
- <result column="submitted_times" property="submittedTimes" />
|
|
|
- <result column="memo_" property="memo" />
|
|
|
- <result column="operation_" property="operation" />
|
|
|
- <result column="create_time_" property="createTime" />
|
|
|
- <result column="update_time_" property="updateTime" />
|
|
|
- </resultMap>
|
|
|
- <sql id="Base_Column_List">
|
|
|
- <!--@mbg.generated-->
|
|
|
- id_, inspection_id_, organ_id_, user_id_, item_, times_, planned_times_, submitted_times,
|
|
|
- memo_, operation_, create_time_, update_time_
|
|
|
- </sql>
|
|
|
- <select id="get" parameterType="java.lang.Long" resultMap="InspectionItem">
|
|
|
- <!--@mbg.generated-->
|
|
|
- select
|
|
|
- <include refid="Base_Column_List" />
|
|
|
- from inspection_item
|
|
|
- where id_ = #{id}
|
|
|
- </select>
|
|
|
- <delete id="delete" parameterType="java.lang.Long">
|
|
|
- <!--@mbg.generated-->
|
|
|
- delete from inspection_item
|
|
|
- where id_ = #{id}
|
|
|
- </delete>
|
|
|
- <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.InspectionItem" useGeneratedKeys="true">
|
|
|
- <!--@mbg.generated-->
|
|
|
- insert into inspection_item (inspection_id_, organ_id_, user_id_, item_, times_, planned_times_,
|
|
|
- submitted_times, memo_, operation_, create_time_, update_time_)
|
|
|
- values (#{inspectionId}, #{organId}, #{userId}, #{item}, #{times}, #{plannedTimes},
|
|
|
- #{submittedTimes}, #{memo}, #{operation}, #{createTime}, #{updateTime})
|
|
|
- </insert>
|
|
|
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.InspectionItem">
|
|
|
- <!--@mbg.generated-->
|
|
|
- update inspection_item
|
|
|
- <set>
|
|
|
- <if test="inspectionId != null">
|
|
|
- inspection_id_ = #{inspectionId},
|
|
|
- </if>
|
|
|
- <if test="organId != null">
|
|
|
- organ_id_ = #{organId},
|
|
|
- </if>
|
|
|
- <if test="userId != null">
|
|
|
- user_id_ = #{userId},
|
|
|
- </if>
|
|
|
- <if test="item != null">
|
|
|
- item_ = #{item},
|
|
|
- </if>
|
|
|
- <if test="times != null">
|
|
|
- times_ = #{times},
|
|
|
- </if>
|
|
|
- <if test="plannedTimes != null">
|
|
|
- planned_times_ = #{plannedTimes},
|
|
|
- </if>
|
|
|
- <if test="submittedTimes != null">
|
|
|
- submitted_times = #{submittedTimes},
|
|
|
- </if>
|
|
|
- <if test="memo != null">
|
|
|
- memo_ = #{memo},
|
|
|
- </if>
|
|
|
- <if test="operation != null">
|
|
|
- operation_ = #{operation},
|
|
|
- </if>
|
|
|
- <if test="createTime != null">
|
|
|
- create_time_ = #{createTime},
|
|
|
- </if>
|
|
|
- <if test="updateTime != null">
|
|
|
- update_time_ = #{updateTime},
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- where id_ = #{id}
|
|
|
- </update>
|
|
|
+ <resultMap id="InspectionItem" type="com.ym.mec.biz.dal.entity.InspectionItem">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ <!--@Table inspection_item-->
|
|
|
+ <id column="id_" property="id"/>
|
|
|
+ <result column="inspection_id_" property="inspectionId"/>
|
|
|
+ <result column="organ_id_" property="organId"/>
|
|
|
+ <result column="user_id_" property="userId"/>
|
|
|
+ <result column="item_" property="item"/>
|
|
|
+ <result column="times_" property="times"/>
|
|
|
+ <result column="planned_times_" property="plannedTimes"/>
|
|
|
+ <result column="submitted_times" property="submittedTimes"/>
|
|
|
+ <result column="memo_" property="memo"/>
|
|
|
+ <result column="operation_" property="operation"/>
|
|
|
+ <result column="create_time_" property="createTime"/>
|
|
|
+ <result column="update_time_" property="updateTime"/>
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ id_, inspection_id_, organ_id_, user_id_, item_, times_, planned_times_, submitted_times,
|
|
|
+ memo_, operation_, create_time_, update_time_
|
|
|
+ </sql>
|
|
|
+ <select id="get" parameterType="java.lang.Long" resultMap="InspectionItem">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from inspection_item
|
|
|
+ where id_ = #{id}
|
|
|
+ </select>
|
|
|
+ <delete id="delete" parameterType="java.lang.Long">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ delete from inspection_item
|
|
|
+ where id_ = #{id}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.InspectionItem"
|
|
|
+ useGeneratedKeys="true">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ insert into inspection_item (inspection_id_, organ_id_, user_id_, item_, times_, planned_times_,
|
|
|
+ submitted_times, memo_, operation_, create_time_, update_time_)
|
|
|
+ values (#{inspectionId}, #{organId}, #{userId}, #{item}, #{times}, #{plannedTimes},
|
|
|
+ #{submittedTimes}, #{memo}, #{operation}, #{createTime}, #{updateTime})
|
|
|
+ </insert>
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.InspectionItem">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ update inspection_item
|
|
|
+ <set>
|
|
|
+ <if test="inspectionId != null">
|
|
|
+ inspection_id_ = #{inspectionId},
|
|
|
+ </if>
|
|
|
+ <if test="organId != null">
|
|
|
+ organ_id_ = #{organId},
|
|
|
+ </if>
|
|
|
+ <if test="userId != null">
|
|
|
+ user_id_ = #{userId},
|
|
|
+ </if>
|
|
|
+ <if test="item != null">
|
|
|
+ item_ = #{item},
|
|
|
+ </if>
|
|
|
+ <if test="times != null">
|
|
|
+ times_ = #{times},
|
|
|
+ </if>
|
|
|
+ <if test="plannedTimes != null">
|
|
|
+ planned_times_ = #{plannedTimes},
|
|
|
+ </if>
|
|
|
+ <if test="submittedTimes != null">
|
|
|
+ submitted_times = #{submittedTimes},
|
|
|
+ </if>
|
|
|
+ <if test="memo != null">
|
|
|
+ memo_ = #{memo},
|
|
|
+ </if>
|
|
|
+ <if test="operation != null">
|
|
|
+ operation_ = #{operation},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time_ = #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time_ = #{updateTime},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id_ = #{id}
|
|
|
+ </update>
|
|
|
+ <!-- 获取任务项数目及总次数 -->
|
|
|
+ <select id="getItemCountAndTimes" resultMap="InspectionItem">
|
|
|
+ SELECT inspection_id_ ,IFNULL(COUNT(*),0) planned_times_,SUM(times_) times_ FROM inspection_item
|
|
|
+ WHERE inspection_id_ IN
|
|
|
+ <foreach collection="inspectionIds" item="inspectionId" open="(" close=")" separator=",">
|
|
|
+ #{inspectionId}
|
|
|
+ </foreach>
|
|
|
+ GROUP BY inspection_id_
|
|
|
+ </select>
|
|
|
</mapper>
|