|
@@ -7,27 +7,34 @@
|
|
|
<resultMap type="com.bosshand.virgo.api.model.WorkOrder" id="workOrderResult">
|
|
|
<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="projectItemTargetRoomIds" property="projectItemTargetRoomIds"/>
|
|
|
+ <result column="tenantType" property="tenantType"/>
|
|
|
+ <result column="merchantId" property="merchantId"/>
|
|
|
+ <result column="merchantName" property="merchantName"/>
|
|
|
+ <result column="clientId" property="clientId"/>
|
|
|
+ <result column="clientName" property="clientName"/>
|
|
|
<result column="userId" property="userId"/>
|
|
|
+ <result column="contractId" property="contractId"/>
|
|
|
+ <result column="contractCode" property="contractCode"/>
|
|
|
+ <result column="deviceName" property="deviceName"/>
|
|
|
+ <result column="followUpPerson" property="followUpPerson"/>
|
|
|
+ <result column="followUpPersonPhone" property="followUpPersonPhone"/>
|
|
|
+ <result column="workWay" property="workWay"/>
|
|
|
+ <result column="compendious" property="compendious"/>
|
|
|
+ <result column="picture" property="picture"/>
|
|
|
<result column="date" property="date"/>
|
|
|
<result column="name" property="name"/>
|
|
|
<result column="type" property="type"/>
|
|
|
- <result column="state" property="state"/>
|
|
|
- <result column="projectFlowId" property="projectFlowId"/>
|
|
|
- <result column="flowUserList" property="flowUserList"/>
|
|
|
+ <result column="status" property="status"/>
|
|
|
<result column="attachment" property="attachment"/>
|
|
|
- <result column="document" property="document"/>
|
|
|
- <result column="receiver" property="receiver"/>
|
|
|
<result column="data" property="data"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<insert id="insert" parameterType="com.bosshand.virgo.api.model.WorkOrder" useGeneratedKeys="true" keyProperty="id">
|
|
|
- INSERT INTO work_order(`projectId`, `projectItemId`, `projectItemTargetId`, `projectItemTargetRoomId`, `userId`, `date`,
|
|
|
- `name`, `type`, `state`, `projectFlowId`, `flowUserList`, `attachment`, `document`, `receiver`, `data`)
|
|
|
- VALUES (#{projectId}, #{projectItemId}, #{projectItemTargetId}, #{projectItemTargetRoomId}, #{userId}, now(),
|
|
|
- #{name}, #{type}, #{state}, #{projectFlowId}, #{flowUserList}, #{attachment}, #{document}, #{receiver}, #{data})
|
|
|
+ INSERT INTO work_order(`projectId`, `projectItemTargetRoomIds`, `tenantType`, `merchantId`, `clientId`, `userId`, `contractId`, `contractCode`, `deviceName`, `followUpPerson`,
|
|
|
+ `followUpPersonPhone`, `workWay`, `compendious`, `picture`, `date`, `name`, `type`, `status`, `attachment`, `data`)
|
|
|
+ VALUES (#{projectId}, #{projectItemTargetRoomIds}, #{tenantType}, #{merchantId}, #{clientId}, #{userId}, #{contractId}, #{contractCode}, #{deviceName}, #{followUpPerson},
|
|
|
+ #{followUpPersonPhone}, #{workWay}, #{compendious}, #{picture}, now(), #{name}, #{type}, #{status}, #{attachment}, #{data})
|
|
|
</insert>
|
|
|
|
|
|
<delete id="delete">
|
|
@@ -38,92 +45,98 @@
|
|
|
UPDATE work_order
|
|
|
<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="date==null">date=now(),</if>
|
|
|
+ <if test="projectItemTargetRoomIds!=null">projectItemTargetRoomIds=#{projectItemTargetRoomIds},</if>
|
|
|
+ <if test="tenantType!=null">tenantType=#{tenantType},</if>
|
|
|
+ <if test="merchantId!=0">merchantId=#{merchantId},</if>
|
|
|
+ <if test="clientId!=0">clientId=#{clientId},</if>
|
|
|
+ <if test="userId!=0">userId=#{userId},</if>
|
|
|
+ <if test="contractId!=0">contractId=#{contractId},</if>
|
|
|
+ <if test="contractCode!=null">contractCode=#{contractCode},</if>
|
|
|
+ <if test="deviceName!=null">deviceName=#{deviceName},</if>
|
|
|
+ <if test="followUpPerson!=null">followUpPerson=#{followUpPerson},</if>
|
|
|
+ <if test="followUpPersonPhone!=null">followUpPersonPhone=#{followUpPersonPhone},</if>
|
|
|
+ <if test="workWay!=null">workWay=#{workWay},</if>
|
|
|
+ <if test="compendious!=null">compendious=#{compendious},</if>
|
|
|
+ <if test="picture!=null">picture=#{picture},</if>
|
|
|
<if test="name!=null">name=#{name},</if>
|
|
|
- <if test="type!=0">type=#{type},</if>
|
|
|
- <if test="state!=-1">state=#{state},</if>
|
|
|
- <if test="projectFlowId!=0">projectFlowId=#{projectFlowId},</if>
|
|
|
- <if test="flowUserList!=null">flowUserList=#{flowUserList},</if>
|
|
|
+ <if test="type!=null">type=#{type},</if>
|
|
|
+ <if test="status!=null">status=#{status},</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>
|
|
|
|
|
|
+ <sql id="query">
|
|
|
+ SELECT a.*, c.name as merchantName, d.name as clientName FROM work_order a
|
|
|
+ LEFT JOIN merchant c ON a.merchantId = c.id
|
|
|
+ LEFT JOIN mgr_client d ON a.clientId = d.id
|
|
|
+ </sql>
|
|
|
+
|
|
|
<select id="get" resultMap="workOrderResult">
|
|
|
- SELECT * FROM work_order where id = #{id}
|
|
|
+ <include refid="query"/>
|
|
|
+ where a.id = #{id}
|
|
|
</select>
|
|
|
|
|
|
<select id="getTotalCount" parameterType="com.bosshand.virgo.api.model.WorkOrder" resultType="Integer">
|
|
|
SELECT count(*) FROM work_order
|
|
|
<where>
|
|
|
- <if test="projectId!=0">
|
|
|
- and projectId=#{projectId}
|
|
|
- </if>
|
|
|
- <if test="projectItemId!=0">
|
|
|
- and projectItemId=#{projectItemId}
|
|
|
- </if>
|
|
|
- <if test="projectItemTargetId!=0">
|
|
|
- and projectItemTargetId=#{projectItemTargetId}
|
|
|
- </if>
|
|
|
- <if test="projectItemTargetRoomId!=0">
|
|
|
- and projectItemTargetRoomId=#{projectItemTargetRoomId}
|
|
|
- </if>
|
|
|
- <if test="userId!=0">
|
|
|
- and userId=#{userId}
|
|
|
- </if>
|
|
|
- <if test="name!=null">
|
|
|
- and name=#{name}
|
|
|
- </if>
|
|
|
- <if test="type!=0">
|
|
|
- and type=#{type}
|
|
|
- </if>
|
|
|
- <if test="state!=-1">
|
|
|
- and state=#{state}
|
|
|
- </if>
|
|
|
- <if test="projectFlowId!=0">
|
|
|
- and projectFlowId=#{projectFlowId}
|
|
|
- </if>
|
|
|
+ <if test="projectId!=0">and projectId=#{projectId}</if>
|
|
|
+ <if test="projectItemTargetRoomIds!=null">and projectItemTargetRoomIds=#{projectItemTargetRoomIds}</if>
|
|
|
+ <if test="tenantType!=null">and tenantType=#{tenantType}</if>
|
|
|
+ <if test="merchantId!=0">and merchantId=#{merchantId}</if>
|
|
|
+ <if test="clientId!=0">and clientId=#{clientId}</if>
|
|
|
+ <if test="userId!=0">and userId=#{userId}</if>
|
|
|
+ <if test="contractId!=0">and contractId=#{contractId}</if>
|
|
|
+ <if test="contractCode!=null">and contractCode=#{contractCode}</if>
|
|
|
+ <if test="deviceName!=null">and deviceName=#{deviceName}</if>
|
|
|
+ <if test="followUpPerson!=null">and followUpPerson=#{followUpPerson}</if>
|
|
|
+ <if test="followUpPersonPhone!=null">and followUpPersonPhone=#{followUpPersonPhone}</if>
|
|
|
+ <if test="workWay!=null">and workWay=#{workWay}</if>
|
|
|
+ <if test="compendious!=null">and compendious=#{compendious}</if>
|
|
|
+ <if test="picture!=null">and picture=#{picture}</if>
|
|
|
+ <if test="name!=null">and name=#{name}</if>
|
|
|
+ <if test="type!=null">and type=#{type}</if>
|
|
|
+ <if test="status!=null">and status=#{status}</if>
|
|
|
+ <if test="statusList!=null"> and status in
|
|
|
+ <foreach item="item" index="index" collection="statusList" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="attachment!=null">and attachment=#{attachment}</if>
|
|
|
+ <if test="data!=null">and data=#{data}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
<select id="getLimit" resultMap="workOrderResult">
|
|
|
- SELECT * FROM work_order
|
|
|
+ <include refid="query"/>
|
|
|
<where>
|
|
|
- <if test="p.projectId!=0">
|
|
|
- and projectId=#{p.projectId}
|
|
|
- </if>
|
|
|
- <if test="p.projectItemId!=0">
|
|
|
- and projectItemId=#{p.projectItemId}
|
|
|
- </if>
|
|
|
- <if test="p.projectItemTargetId!=0">
|
|
|
- and projectItemTargetId=#{p.projectItemTargetId}
|
|
|
- </if>
|
|
|
- <if test="p.projectItemTargetRoomId!=0">
|
|
|
- and projectItemTargetRoomId=#{p.projectItemTargetRoomId}
|
|
|
- </if>
|
|
|
- <if test="p.userId!=0">
|
|
|
- and userId=#{p.userId}
|
|
|
- </if>
|
|
|
- <if test="p.name!=null">
|
|
|
- and name=#{p.name}
|
|
|
- </if>
|
|
|
- <if test="p.type!=0">
|
|
|
- and type=#{p.type}
|
|
|
- </if>
|
|
|
- <if test="p.state!=-1">
|
|
|
- and state=#{p.state}
|
|
|
- </if>
|
|
|
- <if test="p.projectFlowId!=0">
|
|
|
- and projectFlowId=#{p.projectFlowId}
|
|
|
- </if>
|
|
|
+ <if test="p.projectId!=0">and a.projectId=#{p.projectId}</if>
|
|
|
+ <if test="p.projectItemTargetRoomIds!=null">and a.projectItemTargetRoomIds=#{p.projectItemTargetRoomIds}</if>
|
|
|
+ <if test="p.tenantType!=null">and a.tenantType=#{p.tenantType}</if>
|
|
|
+ <if test="p.merchantId!=0">and a.merchantId=#{p.merchantId}</if>
|
|
|
+ <if test="p.clientId!=0">and a.clientId=#{p.clientId}</if>
|
|
|
+ <if test="p.userId!=0">and a.userId=#{p.userId}</if>
|
|
|
+ <if test="p.contractId!=0">and a.contractId=#{p.contractId}</if>
|
|
|
+ <if test="p.contractCode!=null">and a.contractCode=#{p.contractCode}</if>
|
|
|
+ <if test="p.deviceName!=null">and a.deviceName=#{p.deviceName}</if>
|
|
|
+ <if test="p.followUpPerson!=null">and a.followUpPerson=#{p.followUpPerson}</if>
|
|
|
+ <if test="p.followUpPersonPhone!=null">and a.followUpPersonPhone=#{p.followUpPersonPhone}</if>
|
|
|
+ <if test="p.workWay!=null">and a.workWay=#{p.workWay}</if>
|
|
|
+ <if test="p.compendious!=null">and a.compendious=#{p.compendious}</if>
|
|
|
+ <if test="p.picture!=null">and a.picture=#{p.picture}</if>
|
|
|
+ <if test="p.name!=null">and a.name=#{p.name}</if>
|
|
|
+ <if test="p.type!=null">and a.type=#{p.type}</if>
|
|
|
+ <if test="p.status!=null">and a.status=#{p.status}</if>
|
|
|
+ <if test="p.statusList!=null"> and a.status in
|
|
|
+ <foreach item="item" index="index" collection="p.statusList" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="p.attachment!=null">and a.attachment=#{p.attachment}</if>
|
|
|
+ <if test="p.data!=null">and a.data=#{p.data}</if>
|
|
|
</where>
|
|
|
- order by date desc
|
|
|
+ order by a.date desc
|
|
|
limit #{currIndex} , #{pageSize}
|
|
|
</select>
|
|
|
|