<?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.gk.hotwork.Mapper.HiddenDangerMapper" >
|
<resultMap id="BaseResultMap" type="com.gk.hotwork.Domain.HiddenDanger" >
|
<!-- -->
|
<id column="id" property="id" jdbcType="BIGINT" />
|
<result column="level" property="level" jdbcType="VARCHAR" />
|
<result column="code" property="code" jdbcType="VARCHAR" />
|
<result column="status" property="status" jdbcType="VARCHAR" />
|
<result column="requestor" property="requestor" jdbcType="VARCHAR" />
|
<result column="requestorid" property="requestorid" jdbcType="BIGINT" />
|
<result column="createtime" property="createtime" jdbcType="TIMESTAMP" />
|
<result column="createnote" property="createnote" jdbcType="VARCHAR" />
|
<result column="rectifytime" property="rectifytime" jdbcType="TIMESTAMP" />
|
<result column="rectifynote" property="rectifynote" jdbcType="VARCHAR" />
|
<result column="rectifydeadline" property="rectifydeadline" jdbcType="VARCHAR" />
|
<result column="rectifier" property="rectifier" jdbcType="VARCHAR" />
|
<result column="rectifierid" property="rectifierid" jdbcType="BIGINT" />
|
<result column="rectifymeasure" property="rectifymeasure" jdbcType="VARCHAR" />
|
<result column="source" property="source" jdbcType="VARCHAR" />
|
<result column="validflag" property="validflag" jdbcType="TINYINT" />
|
<collection property="rectifyResources"
|
ofType="com.gk.hotwork.Domain.HiddenDangerResource"
|
select="selectRectifyResources" column="hiddendangerid=id">
|
|
</collection>
|
|
<collection property="reportResources"
|
ofType="com.gk.hotwork.Domain.HiddenDangerResource"
|
select="selectReportResources" column="hiddendangerid=id">
|
|
</collection>
|
</resultMap>
|
<sql id="Base_Column_List" >
|
<!-- -->
|
id, level, status, requestor,, requestorid,
|
createtime, createnote, rectifytime, rectifynote,
|
validflag
|
</sql>
|
<select id="selectPages" resultMap="BaseResultMap">
|
select *
|
from hiddendanger
|
where
|
validflag = 1
|
<if test="params.requestorid != null and params.requestorid != ''">
|
and requestorid = #{params.requestorid}
|
</if>
|
<if test="params.rectifierid != null and params.rectifierid != ''">
|
and rectifierid = #{params.rectifierid}
|
</if>
|
|
<if test="params.level != null">
|
and level = #{params.level}
|
</if>
|
<if test="params.code != null and params.code != ''">
|
and code like concat("%",#{params.code},"%")
|
</if>
|
|
<if test="params.requestorName != null and params.requestorName != ''">
|
and requestor like concat("%", #{params.requestorName},"%")
|
</if>
|
<if test="params.rectifierName != null and params.rectifierName != ''">
|
and rectifier like concat("%", #{params.rectifierName},"%")
|
</if>
|
|
<if test="params.status != null">
|
and status = #{params.status}
|
</if>
|
<if test="params.source != null and params.source != ''">
|
and source = #{params.source}
|
</if>
|
<if test="params.overTime != null and params.overTime != ''">
|
and rectifydeadline < now()
|
</if>
|
|
order by createtime desc
|
</select>
|
|
<select id="selectRectifyResources" resultType="com.gk.hotwork.Domain.HiddenDangerResource">
|
select *
|
from hiddendangerresource
|
where operation = 'RECTIFICATION'
|
and belongid = #{hiddendangerid}
|
and validflag = 1
|
order by sort
|
</select>
|
|
<select id="selectReportResources" resultType="com.gk.hotwork.Domain.HiddenDangerResource">
|
select *
|
from hiddendangerresource
|
where operation = 'REPORT'
|
and belongid = #{hiddendangerid}
|
and validflag = 1
|
order by sort
|
</select>
|
|
<select id="selectDataGrid" resultType="com.gk.hotwork.Domain.HiddenDanger">
|
select
|
hiddendanger.*
|
from hiddendanger
|
LEFT JOIN task on task.`code` = hiddendanger.taskcode
|
<where>
|
hiddendanger.validflag = 1
|
and hiddendanger.`status` IN ("UNCONFIRMED","RECTIFIED")
|
<if test="condition.starttime != null and condition.starttime != ''">
|
and hiddendanger.`createtime` >= #{condition.starttime}
|
</if>
|
<if test="condition.endtime != null and condition.endtime != ''">
|
and hiddendanger.`createtime` <= #{condition.endtime}
|
</if>
|
|
<if test="condition.company != null and condition.company != ''">
|
and task.constructionunit = #{condition.company}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectStatisticsData" resultType="com.gk.hotwork.Domain.HiddenDanger">
|
select task.constructionunit,
|
COUNT(*) as countNum from hiddendanger
|
LEFT JOIN task on task.`code` = hiddendanger.taskcode
|
<where>
|
hiddendanger.validflag = 1
|
and hiddendanger.`status` IN ("UNCONFIRMED","RECTIFIED")
|
<if test="condition.starttime != null and condition.starttime != ''">
|
and hiddendanger.`createtime` >= #{condition.starttime}
|
</if>
|
<if test="condition.endtime != null and condition.endtime != ''">
|
and hiddendanger.`createtime` <= #{condition.endtime}
|
</if>
|
|
<if test="condition.company != null and condition.company != ''">
|
and task.constructionunit = #{condition.company}
|
</if>
|
</where>
|
group by task.constructionunit
|
</select>
|
<select id="countNumInMonth" resultType="java.lang.Integer">
|
select count(0)
|
from hiddendanger
|
where requestorid = #{id}
|
and date_format(createtime,'%Y-%m') = date_format(now(),'%Y-%m')
|
</select>
|
|
</mapper>
|