|
@@ -16,6 +16,9 @@
|
|
|
<result column="operation_" property="operation"/>
|
|
|
<result column="create_time_" property="createTime"/>
|
|
|
<result column="update_time_" property="updateTime"/>
|
|
|
+ <result column="month" property="month"/>
|
|
|
+ <result column="organName" property="organName"/>
|
|
|
+ <result column="userName" property="userName"/>
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List">
|
|
|
<!--@mbg.generated-->
|
|
@@ -39,7 +42,8 @@
|
|
|
<!--@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,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{times}, #{plannedTimes},
|
|
|
+ values (#{inspectionId}, #{organId}, #{userId}, #{item,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
+ #{times}, #{plannedTimes},
|
|
|
#{submittedTimes}, #{memo}, #{operation}, #{createTime}, #{updateTime})
|
|
|
</insert>
|
|
|
<update id="update" parameterType="com.ym.mec.biz.dal.entity.InspectionItem">
|
|
@@ -99,7 +103,8 @@
|
|
|
VALUE
|
|
|
<foreach collection="inspectionItems" item="inspectionItem" separator=",">
|
|
|
(#{inspectionItem.inspectionId}, #{inspectionItem.organId}, #{inspectionItem.userId},
|
|
|
- #{inspectionItem.item,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{inspectionItem.times}, #{inspectionItem.operation},
|
|
|
+ #{inspectionItem.item,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{inspectionItem.times},
|
|
|
+ #{inspectionItem.operation},
|
|
|
#{inspectionItem.createTime}, #{inspectionItem.updateTime})
|
|
|
</foreach>
|
|
|
</insert>
|
|
@@ -136,6 +141,45 @@
|
|
|
</foreach>
|
|
|
</update>
|
|
|
<delete id="deleteByInspectionId">
|
|
|
- DELETE FROM inspection_item WHERE inspection_id_ = #{InspectionId}
|
|
|
+ DELETE FROM inspection_item
|
|
|
+ WHERE inspection_id_ = #{InspectionId}
|
|
|
</delete>
|
|
|
+
|
|
|
+ <!-- 分页查询 -->
|
|
|
+ <select id="queryPage" resultMap="InspectionItem" parameterType="map">
|
|
|
+ SELECT ii.*,i.month_ month,o.name_ organName,su.real_name_ userName FROM inspection_item ii
|
|
|
+ LEFT JOIN inspection i ON i.id_ = ii.inspection_id_
|
|
|
+ LEFT JOIN organization o ON O.id_=ii.organ_id_
|
|
|
+ LEFT JOIN sys_user su ON su.id_ = ii.user_id_
|
|
|
+ <include refid="queryPageSql"/>
|
|
|
+ ORDER BY ii.id_
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
+ SELECT COUNT(*) FROM inspection_item ii
|
|
|
+ LEFT JOIN inspection i ON i.id_ = ii.inspection_id_
|
|
|
+ <include refid="queryPageSql"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <sql id="queryPageSql">
|
|
|
+ <where>
|
|
|
+ <if test="organId != null">
|
|
|
+ AND FIND_IN_SET(ii.organ_id_,#{organId})
|
|
|
+ </if>
|
|
|
+ <if test="userId != null">
|
|
|
+ AND ii.user_id_ = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="operation != null">
|
|
|
+ AND ii.operation_ = #{operation}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null">
|
|
|
+ AND ii.month_ >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null">
|
|
|
+ <![CDATA[AND ii.month_ <= #{endTime}]]>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
</mapper>
|