273 lines
11 KiB
XML
273 lines
11 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.sercurityControl.decision.mapper.JjPersonMapper">
|
|
|
|
<resultMap type="com.sercurityControl.decision.domain.JjPerson" id="JjPersonMap">
|
|
<result column="id" property="id"/>
|
|
<result column="name" property="name"/>
|
|
<result column="bak_ic" property="bakIc"/>
|
|
<result column="people_type" property="peopleType"/>
|
|
<result column="single_no" property="singleNo"/>
|
|
<result column="bid_no" property="bidNo"/>
|
|
<result column="phone" property="phone"/>
|
|
<result column="team_name" property="teamName"/>
|
|
<result column="people_type_name" property="peopleTypeName"/>
|
|
<result column="create_time" property="createTime"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="TeamAccessMap" type="com.sercurityControl.decision.domain.vo.TeamAccessChangeVo">
|
|
<result column="today_count" property="todayCount"/>
|
|
<result column="yesterday_count" property="yesterdayCount"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="TeamAccessListMap" type="com.sercurityControl.decision.domain.vo.TeamAccessListVo">
|
|
<result column="date_Time" property="dateTime"/>
|
|
<result column="build_unit" property="buildUnit"/>
|
|
<result column="project_name" property="projectName"/>
|
|
<result column="team_name" property="teamName"/>
|
|
<result column="work_content" property="workContent"/>
|
|
<result column="create_time" property="createTime"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="TeamEvaluateMap" type="com.sercurityControl.decision.domain.vo.TeamEvaluateVo">
|
|
<result column="team_name" property="teamName"/>
|
|
<result column="team_evaluate" property="teamEvaluate"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="TeamEvaluateListMap" type="com.sercurityControl.decision.domain.vo.TeamEvaluateListVo">
|
|
<result column="build_unit" property="buildUnit"/>
|
|
<result column="bid_name" property="projectName"/>
|
|
<result column="team_name" property="teamName"/>
|
|
<result column="zhpj" property="evaluateStar"/>
|
|
<result column="createt_time" property="evaluateTime"/>
|
|
</resultMap>
|
|
|
|
<sql id="SelectBaseMap">
|
|
SELECT id,
|
|
name,
|
|
bak_ic,
|
|
people_type,
|
|
people_type_name,
|
|
single_no,
|
|
bid_no,
|
|
phone,
|
|
team_name,
|
|
create_time
|
|
FROM jj_person
|
|
</sql>
|
|
|
|
<!--查询单个-->
|
|
<select id="queryById" resultMap="JjPersonMap">
|
|
<include refid="SelectBaseMap"/>
|
|
WHERE id = #{id}
|
|
</select>
|
|
|
|
<!--分页查询-->
|
|
<select id="queryByPage" resultMap="JjPersonMap">
|
|
<include refid="SelectBaseMap"/>
|
|
WHERE 1 = 1
|
|
<if test="name != null and name != ''">
|
|
AND name = #{name}
|
|
</if>
|
|
<if test="bakIc != null and bakIc != ''">
|
|
AND bak_ic = #{bakIc}
|
|
</if>
|
|
<if test="peopleType != null">
|
|
AND people_type = #{peopleType}
|
|
</if>
|
|
<if test="singleNo != null and singleNo != ''">
|
|
AND single_no = #{singleNo}
|
|
</if>
|
|
<if test="bidNo != null and bidNo != ''">
|
|
AND bid_no = #{bidNo}
|
|
</if>
|
|
<if test="phone != null and phone != ''">
|
|
AND phone = #{phone}
|
|
</if>
|
|
<if test="teamName != null and teamName != ''">
|
|
AND team_name = #{teamName}
|
|
</if>
|
|
<if test="peopleTypeName != null">
|
|
AND people_type_name = #{peopleTypeName}
|
|
</if>
|
|
<if test="createTime != null and createTime != ''">
|
|
AND create_time = #{createTime}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<!--新增所有列-->
|
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
INSERT INTO jj_person(
|
|
<if test="name != null and name != ''">name,</if>
|
|
<if test="bakIc != null and bakIc != ''">bak_ic,</if>
|
|
<if test="peopleType != null">people_type,</if>
|
|
<if test="singleNo != null and singleNo != ''">single_no,</if>
|
|
<if test="bidNo != null and bidNo != ''">bid_no,</if>
|
|
<if test="phone != null and phone != ''">phone,</if>
|
|
<if test="teamName != null and teamName != ''">team_name,</if>
|
|
<if test="peopleTypeName != null and peopleTypeName != ''">people_type_name,</if>
|
|
<if test="createTime != null and createTime != ''">create_time,</if>
|
|
create_time
|
|
)VALUES(
|
|
<if test="name != null and name != ''">#{name},</if>
|
|
<if test="bakIc != null and bakIc != ''">#{bakIc},</if>
|
|
<if test="peopleType != null">#{peopleType},</if>
|
|
<if test="singleNo != null and singleNo != ''">#{singleNo},</if>
|
|
<if test="bidNo != null and bidNo != ''">#{bidNo},</if>
|
|
<if test="phone != null and phone != ''">#{phone},</if>
|
|
<if test="teamName != null and teamName != ''">#{teamName},</if>
|
|
<if test="peopleTypeName != null and peopleTypeName != ''">#{peopleTypeName},</if>
|
|
<if test="createTime != null and createTime != ''">#{createTime},</if>
|
|
sysdate())
|
|
</insert>
|
|
|
|
<!--批量新增-->
|
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
|
INSERT INTO jj_person(
|
|
<if test="name != null and name != ''">name,</if>
|
|
<if test="bakIc != null and bakIc != ''">bak_ic,</if>
|
|
<if test="peopleType != null">people_type,</if>
|
|
<if test="singleNo != null and singleNo != ''">single_no,</if>
|
|
<if test="bidNo != null and bidNo != ''">bid_no,</if>
|
|
<if test="phone != null and phone != ''">phone,</if>
|
|
<if test="teamName != null and teamName != ''">team_name,</if>
|
|
<if test="peopleTypeName != null and peopleTypeName != ''">people_type_name,</if>
|
|
<if test="createTime != null and createTime != ''">create_time,</if>
|
|
create_time
|
|
)VALUES(
|
|
<foreach collection="entities" item="entity" separator=",">
|
|
(
|
|
<if test="name != null and name != ''">#{name},</if>
|
|
<if test="bakIc != null and bakIc != ''">#{bakIc},</if>
|
|
<if test="peopleType != null">#{peopleType},</if>
|
|
<if test="singleNo != null and singleNo != ''">#{singleNo},</if>
|
|
<if test="bidNo != null and bidNo != ''">#{bidNo},</if>
|
|
<if test="phone != null and phone != ''">#{phone},</if>
|
|
<if test="teamName != null and teamName != ''">#{teamName},</if>
|
|
<if test="peopleTypeName != null and peopleTypeName != ''">#{peopleTypeName},</if>
|
|
<if test="createTime != null and createTime != ''">#{createTime},</if>
|
|
sysdate()
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!--通过主键修改数据-->
|
|
<update id="update">
|
|
UPDATE jj_person
|
|
<set>
|
|
<if test="name != null and name != ''">
|
|
name = #{name},
|
|
</if>
|
|
<if test="bakIc != null and bakIc != ''">
|
|
bak_ic = #{bakIc},
|
|
</if>
|
|
<if test="peopleType != null">
|
|
people_type = #{peopleType},
|
|
</if>
|
|
<if test="singleNo != null and singleNo != ''">
|
|
single_no = #{singleNo},
|
|
</if>
|
|
<if test="bidNo != null and bidNo != ''">
|
|
bid_no = #{bidNo},
|
|
</if>
|
|
<if test="phone != null and phone != ''">
|
|
phone = #{phone},
|
|
</if>
|
|
<if test="teamName != null and teamName != ''">
|
|
team_name = #{teamName},
|
|
</if>
|
|
<if test="peopleTypeName != null and peopleTypeName != ''">
|
|
people_type_name = #{peopleTypeName},
|
|
</if>
|
|
<if test="createTime != null and createTime != ''">
|
|
create_time = #{createTime},
|
|
</if>
|
|
</set>
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<!--通过主键删除-->
|
|
<delete id="deleteById">
|
|
DELETE
|
|
FROM jj_person
|
|
WHERE id = #{id}
|
|
</delete>
|
|
|
|
<!-- 新增班组提醒 -->
|
|
<select id="newTeamNotice" resultMap="TeamAccessMap">
|
|
SELECT count(case TO_DAYS(entrance_time) = TO_DAYS(NOW()) when 1 then 0 end) as today_count,
|
|
count(case TO_DAYS(NOW()) - TO_DAYS(entrance_time) = 1 when 1 then 0 end) as yesterday_count
|
|
FROM jj_person
|
|
WHERE people_type = '46'
|
|
</select>
|
|
|
|
<!-- 更多班组列表 -->
|
|
<select id="teamList" resultMap="TeamAccessListMap">
|
|
SELECT jp.team_name,
|
|
jp.entrance_time AS create_time,
|
|
jp.entrance_time AS date_time,
|
|
jbp.build_unit,
|
|
jbp.bid_name AS project_name,
|
|
jz.work_content
|
|
FROM jj_person jp
|
|
LEFT JOIN (SELECT build_unit, bid_no, bid_name,build_no FROM jj_bid_project WHERE is_stop = '0') jbp ON jp.bid_no = jbp.bid_no
|
|
LEFT JOIN (SELECT work_day, work_content, work_manager_num FROM t_class_metting
|
|
<if test="queryDate != null and queryDate != ''">
|
|
WHERE work_day = #{queryDate}
|
|
</if>
|
|
) jz ON jp.bak_ic = jz.work_manager_num
|
|
WHERE people_type = '46'
|
|
<if test="queryDate != null and queryDate != ''">
|
|
and jp.entrance_time = #{queryDate}
|
|
</if>
|
|
<if test="buildNo != null and buildNo != ''">
|
|
and jbp.build_no = #{buildNo}
|
|
</if>
|
|
<if test="projectName != null and projectName != ''">
|
|
and jbp.bid_name like concat('%',#{projectName},'%')
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 班组最新评价 -->
|
|
<select id="teamEvaluateByTime" resultMap="TeamEvaluateMap">
|
|
SELECT team_name,
|
|
zhpj as team_evaluate
|
|
FROM t_team_eva te
|
|
INNER JOIN (SELECT MAX(id) AS id FROM t_team_eva GROUP BY id_number) AS eva
|
|
WHERE te.id = eva.id
|
|
ORDER BY te.zhpj + 0 ${orderType} LIMIT 5
|
|
</select>
|
|
|
|
<!-- 班组综合评价 -->
|
|
<select id="teamEvaluateByMultiple" resultMap="TeamEvaluateMap">
|
|
SELECT team_name, zhpj as team_evaluate
|
|
FROM t_work_team
|
|
WHERE work_off = 0
|
|
AND zhpj != 0
|
|
ORDER BY zhpj + 0 ${orderType} LIMIT 5
|
|
</select>
|
|
|
|
<!-- 班组评价列表 -->
|
|
<select id="teamEvaluateList" resultMap="TeamEvaluateListMap">
|
|
SELECT jz.build_unit, jz.bid_name,te.team_name, te.zhpj,te.createt_time
|
|
FROM t_team_eva te
|
|
LEFT JOIN t_class_metting jz ON te.zbh_id = jz.class_id
|
|
<where>
|
|
<if test="queryDate != null and queryDate != ''">
|
|
and DATE_FORMAT(te.createt_time,'%Y-%m-%d') = #{queryDate}
|
|
</if>
|
|
<if test="buildNo != null and buildNo != ''">
|
|
and jz.org = #{buildNo}
|
|
</if>
|
|
<if test="projectName != null and projectName != ''">
|
|
and jz.bid_name like concat('%',#{projectName},'%')
|
|
</if>
|
|
</where>
|
|
<if test="orderType!= null and orderType != ''">
|
|
ORDER BY te.zhpj + 0 ${orderType}
|
|
</if>
|
|
</select>
|
|
</mapper>
|
|
|