|
@@ -0,0 +1,139 @@
|
|
|
|
+<!DOCTYPE mapper
|
|
|
|
+ PUBLIC "-//mybatis.opg//DTD Mapper 3.0//EN"
|
|
|
|
+ "http://mybatis.opg/dtd/mybatis-3-mapper.dtd">
|
|
|
|
+
|
|
|
|
+<mapper namespace="com.bosshand.virgo.api.operate.dao.OperatePatrolDao">
|
|
|
|
+
|
|
|
|
+ <resultMap type="com.bosshand.virgo.api.operate.model.OperatePatrol" id="operatePatrolResult">
|
|
|
|
+ <id column="id" property="id" />
|
|
|
|
+ <result column="projectId" property="projectId" />
|
|
|
|
+ <result column="projectItemId" property="projectItemId" />
|
|
|
|
+ <result column="projectItemTargetId" property="projectItemTargetId" />
|
|
|
|
+ <result column="projectItemTargetRoomId" property="projectItemTargetRoomId" />
|
|
|
|
+ <result column="name" property="name" />
|
|
|
|
+ <result column="date" property="date" />
|
|
|
|
+ <result column="type" property="type" />
|
|
|
|
+ <result column="remark" property="remark" />
|
|
|
|
+ <result column="attachment" property="attachment" />
|
|
|
|
+ <result column="document" property="document" />
|
|
|
|
+ <result column="receiver" property="receiver" />
|
|
|
|
+ <result column="data" property="data" />
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
|
|
+ <select id="get" resultMap="operatePatrolResult">
|
|
|
|
+ SELECT * FROM operate_patrol where id = #{id}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getList" resultMap="operatePatrolResult">
|
|
|
|
+ SELECT * FROM operate_patrol
|
|
|
|
+ <where>
|
|
|
|
+ <if test="op.id != 0">
|
|
|
|
+ and id = #{op.id}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectId != 0">
|
|
|
|
+ and projectId = #{op.projectId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectItemId != 0">
|
|
|
|
+ and projectItemId = #{op.projectItemId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectItemTargetId != 0">
|
|
|
|
+ and projectItemTargetId = #{op.projectItemTargetId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectItemTargetRoomId != 0">
|
|
|
|
+ and projectItemTargetRoomId = #{op.projectItemTargetRoomId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.name != null">
|
|
|
|
+ and name = #{op.name}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.type != 0">
|
|
|
|
+ and type = #{op.type}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ order by date desc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getListLimit" resultMap="operatePatrolResult">
|
|
|
|
+ SELECT * FROM operate_patrol
|
|
|
|
+ <where>
|
|
|
|
+ <if test="op.id != 0">
|
|
|
|
+ and id = #{op.id}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectId != 0">
|
|
|
|
+ and projectId = #{op.projectId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectItemId != 0">
|
|
|
|
+ and projectItemId = #{op.projectItemId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectItemTargetId != 0">
|
|
|
|
+ and projectItemTargetId = #{op.projectItemTargetId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectItemTargetRoomId != 0">
|
|
|
|
+ and projectItemTargetRoomId = #{op.projectItemTargetRoomId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.name != null">
|
|
|
|
+ and name = #{op.name}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.type != 0">
|
|
|
|
+ and type = #{op.type}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ order by date desc
|
|
|
|
+ limit #{currIndex} , #{pageSize}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="count" parameterType="map" resultType="Integer">
|
|
|
|
+ SELECT count(*) FROM operate_patrol
|
|
|
|
+ <where>
|
|
|
|
+ <if test="op.id != 0">
|
|
|
|
+ and id = #{op.id}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectId != 0">
|
|
|
|
+ and projectId = #{op.projectId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectItemId != 0">
|
|
|
|
+ and projectItemId = #{op.projectItemId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectItemTargetId != 0">
|
|
|
|
+ and projectItemTargetId = #{op.projectItemTargetId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.projectItemTargetRoomId != 0">
|
|
|
|
+ and projectItemTargetRoomId = #{op.projectItemTargetRoomId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.name != null">
|
|
|
|
+ and name = #{op.name}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="op.type != 0">
|
|
|
|
+ and type = #{op.type}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <insert id="save" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
+ INSERT INTO operate_patrol(projectId, projectItemId, projectItemTargetId, projectItemTargetRoomId, date, data, name, remark, attachment, document, receiver, type)
|
|
|
|
+ VALUES (#{projectId}, #{projectItemId}, #{projectItemTargetId}, #{projectItemTargetRoomId}, now(), #{data}, #{name}, #{remark}, #{attachment}, #{document}, #{receiver}, #{type})
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <delete id="delete">
|
|
|
|
+ DELETE FROM operate_patrol WHERE id=#{id}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <update id="update" parameterType="com.bosshand.virgo.api.operate.model.OperatePatrol">
|
|
|
|
+ UPDATE operate_patrol
|
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
|
+ <if test="projectId!=0">projectId=#{projectId},</if>
|
|
|
|
+ <if test="projectItemId!=0">projectItemId=#{projectItemId},</if>
|
|
|
|
+ <if test="projectItemTargetId!=0">projectItemTargetId=#{projectItemTargetId},</if>
|
|
|
|
+ <if test="projectItemTargetRoomId!=0">projectItemTargetRoomId=#{projectItemTargetRoomId},</if>
|
|
|
|
+ <if test="type!=0">type=#{type},</if>
|
|
|
|
+ <if test="name!=null">name=#{name},</if>
|
|
|
|
+ <if test="remark!=null">remark=#{remark},</if>
|
|
|
|
+ <if test="attachment!=null">attachment=#{attachment},</if>
|
|
|
|
+ <if test="document!=null">document=#{document},</if>
|
|
|
|
+ <if test="receiver!=null">receiver=#{receiver},</if>
|
|
|
|
+ <if test="data!=null">data=#{data},</if>
|
|
|
|
+ </trim>
|
|
|
|
+ WHERE id=#{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+</mapper>
|