|
@@ -1,134 +1,146 @@
|
|
|
<?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.InspectionItemPlanDao">
|
|
|
- <resultMap id="InspectionItemPlan" type="com.ym.mec.biz.dal.entity.InspectionItemPlan">
|
|
|
- <!--@mbg.generated-->
|
|
|
- <!--@Table inspection_item_plan-->
|
|
|
- <id column="id_" property="id" />
|
|
|
- <result column="inspection_id_" property="inspectionId" />
|
|
|
- <result column="item_id_" property="itemId" />
|
|
|
- <result column="user_id_" property="userId" />
|
|
|
- <result column="plan_start_" property="planStart" />
|
|
|
- <result column="plan_end_" property="planEnd" />
|
|
|
- <result column="cooperation_organ_id_" property="cooperationOrganId" />
|
|
|
- <result column="music_group_id_" property="musicGroupId" />
|
|
|
- <result column="school_gps_" property="schoolGps" />
|
|
|
- <result column="submited_gps_" property="submitedGps" />
|
|
|
- <result column="submited_time_" property="submitedTime" />
|
|
|
- <result column="memo_" property="memo" />
|
|
|
- <result column="status_" property="status" />
|
|
|
- <result column="create_time_" property="createTime" />
|
|
|
- <result column="update_time_" property="updateTime" />
|
|
|
- <result column="cooperationName" property="cooperationName" />
|
|
|
- <result column="musicGroupName" property="musicGroupName" />
|
|
|
- </resultMap>
|
|
|
- <sql id="Base_Column_List">
|
|
|
- <!--@mbg.generated-->
|
|
|
- id_, inspection_id_, item_id_, user_id_, plan_start_, plan_end_, cooperation_organ_id_,
|
|
|
- music_group_id_, school_gps_, submited_gps_, submited_time_, memo_, status_, create_time_,
|
|
|
- update_time_
|
|
|
- </sql>
|
|
|
- <select id="get" parameterType="java.lang.Integer" resultMap="InspectionItemPlan">
|
|
|
- <!--@mbg.generated-->
|
|
|
- select
|
|
|
- <include refid="Base_Column_List" />
|
|
|
- from inspection_item_plan
|
|
|
- where id_ = #{id}
|
|
|
- </select>
|
|
|
- <delete id="delete" parameterType="java.lang.Integer">
|
|
|
- <!--@mbg.generated-->
|
|
|
- delete from inspection_item_plan
|
|
|
- where id_ = #{id}
|
|
|
- </delete>
|
|
|
- <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.InspectionItemPlan" useGeneratedKeys="true">
|
|
|
- <!--@mbg.generated-->
|
|
|
- insert into inspection_item_plan (inspection_id_, item_id_, user_id_, plan_start_, plan_end_, cooperation_organ_id_,
|
|
|
- music_group_id_, school_gps_, submited_gps_, submited_time_, memo_, status_,
|
|
|
- create_time_, update_time_)
|
|
|
- values (#{inspectionId}, #{itemId}, #{userId}, #{planStart}, #{planEnd}, #{cooperationOrganId},
|
|
|
- #{musicGroupId}, #{schoolGps}, #{submitedGps}, #{submitedTime}, #{memo}, #{status},
|
|
|
- #{createTime}, #{updateTime})
|
|
|
- </insert>
|
|
|
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.InspectionItemPlan">
|
|
|
- <!--@mbg.generated-->
|
|
|
- update inspection_item_plan
|
|
|
- <set>
|
|
|
- <if test="inspectionId != null">
|
|
|
- inspection_id_ = #{inspectionId},
|
|
|
- </if>
|
|
|
- <if test="itemId != null">
|
|
|
- item_id_ = #{itemId},
|
|
|
- </if>
|
|
|
- <if test="userId != null">
|
|
|
- user_id_ = #{userId},
|
|
|
- </if>
|
|
|
- <if test="planStart != null">
|
|
|
- plan_start_ = #{planStart},
|
|
|
- </if>
|
|
|
- <if test="planEnd != null">
|
|
|
- plan_end_ = #{planEnd},
|
|
|
- </if>
|
|
|
- <if test="cooperationOrganId != null">
|
|
|
- cooperation_organ_id_ = #{cooperationOrganId},
|
|
|
- </if>
|
|
|
- <if test="musicGroupId != null">
|
|
|
- music_group_id_ = #{musicGroupId},
|
|
|
- </if>
|
|
|
- <if test="schoolGps != null">
|
|
|
- school_gps_ = #{schoolGps},
|
|
|
- </if>
|
|
|
- <if test="submitedGps != null">
|
|
|
- submited_gps_ = #{submitedGps},
|
|
|
- </if>
|
|
|
- <if test="submitedTime != null">
|
|
|
- submited_time_ = #{submitedTime},
|
|
|
- </if>
|
|
|
- <if test="memo != null">
|
|
|
- memo_ = #{memo},
|
|
|
- </if>
|
|
|
- <if test="status != null">
|
|
|
- status_ = #{status},
|
|
|
- </if>
|
|
|
- <if test="createTime != null">
|
|
|
- create_time_ = #{createTime},
|
|
|
- </if>
|
|
|
- <if test="updateTime != null">
|
|
|
- update_time_ = #{updateTime},
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- where id_ = #{id}
|
|
|
- </update>
|
|
|
+ <resultMap id="InspectionItemPlan" type="com.ym.mec.biz.dal.entity.InspectionItemPlan">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ <!--@Table inspection_item_plan-->
|
|
|
+ <id column="id_" property="id"/>
|
|
|
+ <result column="inspection_id_" property="inspectionId"/>
|
|
|
+ <result column="item_id_" property="itemId"/>
|
|
|
+ <result column="user_id_" property="userId"/>
|
|
|
+ <result column="plan_start_" property="planStart"/>
|
|
|
+ <result column="plan_end_" property="planEnd"/>
|
|
|
+ <result column="cooperation_organ_id_" property="cooperationOrganId"/>
|
|
|
+ <result column="music_group_id_" property="musicGroupId"/>
|
|
|
+ <result column="school_gps_" property="schoolGps"/>
|
|
|
+ <result column="submited_gps_" property="submitedGps"/>
|
|
|
+ <result column="submited_time_" property="submitedTime"/>
|
|
|
+ <result column="memo_" property="memo"/>
|
|
|
+ <result column="status_" property="status"/>
|
|
|
+ <result column="create_time_" property="createTime"/>
|
|
|
+ <result column="update_time_" property="updateTime"/>
|
|
|
+ <result column="cooperationName" property="cooperationName"/>
|
|
|
+ <result column="musicGroupName" property="musicGroupName"/>
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ id_, inspection_id_, item_id_, user_id_, plan_start_, plan_end_, cooperation_organ_id_,
|
|
|
+ music_group_id_, school_gps_, submited_gps_, submited_time_, memo_, status_, create_time_,
|
|
|
+ update_time_
|
|
|
+ </sql>
|
|
|
+ <select id="get" parameterType="java.lang.Integer" resultMap="InspectionItemPlan">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from inspection_item_plan
|
|
|
+ where id_ = #{id}
|
|
|
+ </select>
|
|
|
+ <delete id="delete" parameterType="java.lang.Integer">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ delete from inspection_item_plan
|
|
|
+ where id_ = #{id}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.InspectionItemPlan"
|
|
|
+ useGeneratedKeys="true">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ insert into inspection_item_plan (inspection_id_, item_id_, user_id_, plan_start_, plan_end_,
|
|
|
+ cooperation_organ_id_,
|
|
|
+ music_group_id_, school_gps_, submited_gps_, submited_time_, memo_, status_,
|
|
|
+ create_time_, update_time_)
|
|
|
+ values (#{inspectionId}, #{itemId}, #{userId}, #{planStart}, #{planEnd}, #{cooperationOrganId},
|
|
|
+ #{musicGroupId}, #{schoolGps}, #{submitedGps}, #{submitedTime}, #{memo}, #{status},
|
|
|
+ #{createTime}, #{updateTime})
|
|
|
+ </insert>
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.InspectionItemPlan">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ update inspection_item_plan
|
|
|
+ <set>
|
|
|
+ <if test="inspectionId != null">
|
|
|
+ inspection_id_ = #{inspectionId},
|
|
|
+ </if>
|
|
|
+ <if test="itemId != null">
|
|
|
+ item_id_ = #{itemId},
|
|
|
+ </if>
|
|
|
+ <if test="userId != null">
|
|
|
+ user_id_ = #{userId},
|
|
|
+ </if>
|
|
|
+ <if test="planStart != null">
|
|
|
+ plan_start_ = #{planStart},
|
|
|
+ </if>
|
|
|
+ <if test="planEnd != null">
|
|
|
+ plan_end_ = #{planEnd},
|
|
|
+ </if>
|
|
|
+ <if test="cooperationOrganId != null">
|
|
|
+ cooperation_organ_id_ = #{cooperationOrganId},
|
|
|
+ </if>
|
|
|
+ <if test="musicGroupId != null">
|
|
|
+ music_group_id_ = #{musicGroupId},
|
|
|
+ </if>
|
|
|
+ <if test="schoolGps != null">
|
|
|
+ school_gps_ = #{schoolGps},
|
|
|
+ </if>
|
|
|
+ <if test="submitedGps != null">
|
|
|
+ submited_gps_ = #{submitedGps},
|
|
|
+ </if>
|
|
|
+ <if test="submitedTime != null">
|
|
|
+ submited_time_ = #{submitedTime},
|
|
|
+ </if>
|
|
|
+ <if test="memo != null">
|
|
|
+ memo_ = #{memo},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ status_ = #{status},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time_ = #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time_ = #{updateTime},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id_ = #{id}
|
|
|
+ </update>
|
|
|
|
|
|
- <!-- 分页查询 -->
|
|
|
- <select id="queryPage" resultMap="InspectionItemPlan" parameterType="map">
|
|
|
- SELECT iip.*,co.name_ cooperationName,mg.name_ musicGroupName FROM inspection_item_plan iip
|
|
|
- LEFT JOIN cooperation_organ co ON co.id_=iip.cooperation_organ_id_
|
|
|
- LEFT JOIN music_group mg ON mg.id_ = iip.music_group_id_
|
|
|
- <include refid="queryPageSql"/>
|
|
|
- ORDER BY iip.plan_start_ ASC
|
|
|
- <include refid="global.limit"/>
|
|
|
- </select>
|
|
|
+ <!-- 分页查询 -->
|
|
|
+ <select id="queryPage" resultMap="InspectionItemPlan" parameterType="map">
|
|
|
+ SELECT iip.*,co.name_ cooperationName,mg.name_ musicGroupName FROM inspection_item_plan iip
|
|
|
+ LEFT JOIN cooperation_organ co ON co.id_=iip.cooperation_organ_id_
|
|
|
+ LEFT JOIN music_group mg ON mg.id_ = iip.music_group_id_
|
|
|
+ <include refid="queryPageSql"/>
|
|
|
+ ORDER BY iip.plan_start_ ASC
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
|
|
|
- <!-- 查询当前表的总记录数 -->
|
|
|
- <select id="queryCount" resultType="int">
|
|
|
- SELECT COUNT(*) FROM inspection_item_plan iip
|
|
|
- <include refid="queryPageSql"/>
|
|
|
- </select>
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
+ SELECT COUNT(*) FROM inspection_item_plan iip
|
|
|
+ LEFT JOIN music_group mg ON mg.id_ = iip.music_group_id_
|
|
|
+ <include refid="queryPageSql"/>
|
|
|
+ </select>
|
|
|
|
|
|
- <sql id="queryPageSql">
|
|
|
- <where>
|
|
|
- <if test="itemId != null">
|
|
|
- AND iip.item_id_ = #{itemId}
|
|
|
- </if>
|
|
|
- <if test="userId != null">
|
|
|
- AND iip.user_id_ = #{userId}
|
|
|
- </if>
|
|
|
- <if test="startTime != null">
|
|
|
- AND iip.plan_start_ >= #{startTime}
|
|
|
- </if>
|
|
|
- <if test="endTime != null">
|
|
|
- <![CDATA[AND iip.plan_start_ <= #{endTime}]]>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </sql>
|
|
|
+ <sql id="queryPageSql">
|
|
|
+ <where>
|
|
|
+ <if test="itemId != null">
|
|
|
+ AND iip.item_id_ = #{itemId}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null">
|
|
|
+ AND iip.user_id_ = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test='hasSubmit != null and hasSubmit.toString()=="1".toString()'>
|
|
|
+ AND iip.status_ > 0
|
|
|
+ </if>
|
|
|
+ <if test='hasSubmit != null and hasSubmit.toString()=="0".toString()'>
|
|
|
+ AND iip.status_ = 0
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null">
|
|
|
+ AND iip.plan_start_ >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null">
|
|
|
+ <![CDATA[AND iip.plan_start_ <= #{endTime}]]>
|
|
|
+ </if>
|
|
|
+ <if test="search != null">
|
|
|
+ AND mg.name LIKE CONCAT('%', #{search}, '%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
</mapper>
|