lj-zhgd-ht/bonus-modules/bonus-bracelet/src/main/resources/mapper/bracelet/QueryConstructionMapper.xml

51 lines
2.4 KiB
XML

<?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.bonus.bracelet.mapper.QueryConstructionMapper">
<resultMap type="com.bonus.common.entity.bracelet.vo.QueryConstruction" id="QueryConstructionResult">
<id property="proname" column="proname" />
<result property="departname" column="departname" />
<result property="teamname" column="teamname" />
<result property="teamleader" column="teamleader" />
<result property="teamnum" column="teamnum" />
<result property="tempnum" column="tempnum" />
<result property="lytime" column="lytime" />
<result property="warnnum" column="warnnum" />
</resultMap>
<select id="selectConstructionList" parameterType="com.bonus.common.entity.bracelet.vo.QueryConstruction" resultMap="QueryConstructionResult">
select a.lytime,tp.pro_name as proname,tpd.depart_name as departname,twt.team_name as teamname,concat(twt.team_leader,' \ ',twt.leader_phone) as teamleader,
count(DISTINCT tbp.id) as teamnum,count(DISTINCT tlu.id) as tempnum,count(DISTINCT tw.id) as warnnum
from
(select tdu.pro_id,tdu.team_id as teamid,tdu.pro_id as proid,DATE(tdub.ly_time) as lytime
from tb_dev_use tdu
left join tb_dev_use_bid tdub on tdub.id = tdu.id
where tdu.del_flag = 0) a
left join tb_project tp on tp.id = a.proid
left join t_work_team twt on twt.team_id = a.teamid and twt.pro_id = tp.id
left join tb_project_depart tpd on tpd.id = tp.depart_id
left join tb_bracelet tb on tb.del_flag = 0
left join tb_people tbp on tbp.id = tb.bid_id and peopel_type = 0 and tbp.team_id = a.teamid and tbp.del_flag = 0
left join tb_ls_user tlu on tlu.id = tb.bid_id and peopel_type = 1 and tlu.team_id = a.teamid
left join tb_warn tw on tw.pro_id = a.pro_id and tw.del_flag = 0
<where>
tp.del_flag = 0 and twt.del_flag = 0
<if test="proname != null and proname != ''">
and tp.pro_name = #{proname}
</if>
<if test="departname != null and departname != ''">
and tpd.depart_name = #{departname}
</if>
<if test="teamname != null and teamname != ''">
and twt.team_name = #{teamname}
</if>
<if test="lytime != null ">
and DATE(a.lytime) = #{lytime}
</if>
</where>
group by a.lytime,proname,departname,teamname,teamleader
</select>
</mapper>