<?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="org.springblade.modules.taskqd.mapper.TaskqdMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="taskResultMap" type="org.springblade.modules.taskqd.vo.TaskqdVO">
|
<id column="id" property="id"/>
|
<result column="rname" property="rname"/>
|
<result column="content" property="content"/>
|
<result column="time" property="time"/>
|
<result column="province" property="province"/>
|
<result column="city" property="city"/>
|
<result column="county" property="county"/>
|
<result column="jnum" property="jnum"/>
|
<result column="line" property="line"/>
|
<result column="rtype" property="rtype"/>
|
<result column="serid" property="serid"/>
|
<result column="integral" property="integral"/>
|
<result column="url" property="url"/>
|
<result column="captain" property="captain"/>
|
<result column="team" property="team"/>
|
<result column="iscation" property="iscation"/>
|
<result column="publisher" property="publisher"/>
|
<result column="fid" property="fid"/>
|
<result column="fname" property="fname"/>
|
<result column="gather" property="gather"/>
|
<result column="gathername" property="gathername"/>
|
<result column="tasktype" property="tasktype"/>
|
<result column="phone" property="phone"/>
|
<result column="train" property="train"/>
|
</resultMap>
|
|
|
<update id="updatet">
|
update sys_taskqd
|
SET serid=#{serid},
|
num=#{num}
|
<if test="param4!='' and param4!=null">
|
,captain =#{param4}
|
</if>
|
<if test="param5!='' and param5!=null">
|
,team =#{param5}
|
</if>
|
where id = #{id}
|
</update>
|
<update id="updateRtype">
|
update sys_taskqd
|
SET rtype=#{type}
|
where id = #{rid}
|
</update>
|
|
<update id="updateSerid">
|
update sys_taskqd
|
SET serid=#{serid},team=#{newteam},num=#{newnum}
|
where id = #{rid}
|
</update>
|
|
<!--日常任务列表-->
|
<select id="getlist" resultMap="taskResultMap">
|
SELECT
|
*
|
FROM
|
sys_taskqd
|
WHERE
|
serid LIKE concat("%",#{id},"%")
|
<if test="type == 3">
|
and rtype = 1
|
</if>
|
<if test="type == 2">
|
AND ( rtype = "0" OR rtype = "2" )
|
</if>
|
</select>
|
|
<!--任务统计-->
|
<select id="selectList" resultMap="taskResultMap">
|
select jnum, num, serid, team ,time
|
from sys_taskqd
|
where id = #{id}
|
</select>
|
<select id="taskCount" resultType="java.util.HashMap">
|
SELECT
|
count( * ) AS count
|
FROM
|
sys_taskqd
|
WHERE
|
serid LIKE concat("%",#{id},"%")
|
AND rtype = "1" UNION ALL
|
SELECT
|
count( * ) AS count
|
FROM
|
sys_taskqd
|
WHERE
|
serid LIKE concat("%",#{id},"%")
|
AND ( rtype = "0" OR rtype = "2" )
|
</select>
|
|
<select id="queryReceiver" resultType="java.util.HashMap">
|
SELECT u.*,
|
r.role_name
|
FROM blade_user u
|
LEFT JOIN (SELECT id, role_name FROM blade_role) r on u.role_id = r.id
|
WHERE u.id in (${serid})
|
</select>
|
|
<select id="selectLi" resultMap="taskResultMap">
|
SELECT A.*,IFNULL(B.num,0) as nums FROM (
|
select qd.* from sys_taskqd qd LEFT JOIN sys_jurisdiction j ON j.id = qd.jurisdiction where 1=1 AND
|
<if test="type==0">
|
(qd.rtype = "2" or qd.rtype = "0") AND
|
find_in_set(#{serid}, serid) and qd.tasktype=#{tasktype}) A LEFT JOIN (SELECT COUNT(*) as num,hdid,serid
|
FROM
|
sys_taskfk WHERE
|
serid=#{serid} GROUP BY hdid,serid) B ON A.id=B.hdid
|
</if>
|
<if test="type==2">
|
qd.rtype = "1" AND
|
find_in_set(#{serid}, serid) and qd.tasktype=#{tasktype}) A LEFT JOIN (SELECT COUNT(*) as num,hdid,serid
|
FROM
|
sys_taskfk WHERE
|
serid=#{serid} GROUP BY hdid,serid) B ON A.id=B.hdid
|
</if>
|
<if test="type==1">
|
<if test="jurisdiction!='1372091709474910209'">
|
<if test="tasktype !=2">
|
qd.jnum!=qd.num AND
|
</if>
|
qd.rtype = "2"
|
and qd.tasktype=#{tasktype}
|
and (!find_in_set(#{serid}, serid) OR serid IS NULL )
|
and
|
((j.id =#{jurisdiction} or
|
j.parent_id = #{jurisdiction}) or (j.id =#{workjurisdiction} or
|
j.parent_id = #{workjurisdiction}))
|
</if>
|
) A LEFT JOIN (SELECT
|
COUNT(*)
|
as num,hdid FROM sys_taskfk GROUP BY hdid) B ON A.id=B.hdid
|
</if>
|
</select>
|
|
<select id="selectNum" resultType="java.util.HashMap">
|
SELECT COUNT(*) as num, tasktype
|
FROM sys_taskqd qd
|
LEFT JOIN sys_jurisdiction j ON j.id = qd.jurisdiction
|
WHERE jnum!=num AND qd.rtype = "2" AND
|
(!find_in_set(#{serid}
|
, serid)
|
OR serid IS NULL )
|
and ((j.id =#{jurisdiction}
|
or j.parent_id = #{jurisdiction})
|
or (j.id =#{workjurisdiction}
|
or j.parent_id = #{workjurisdiction}))
|
GROUP BY tasktype
|
</select>
|
|
<select id="querySerid" resultType="java.lang.String">
|
SELECT serid
|
from sys_taskqd
|
where id = #{rid}
|
</select>
|
</mapper>
|