123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?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.zhgd.scs.mapper.HidWorklistMapper">
- <resultMap id="BaseResultMap" type="com.zhgd.scs.domain.HidWorklist">
- <id property="id" column="id" jdbcType="BIGINT"/>
- <result property="fid" column="fid" jdbcType="BIGINT"/>
- <result property="createdDate" column="created_date" jdbcType="TIMESTAMP"/>
- <result property="createdPerson" column="created_person" jdbcType="BIGINT"/>
- <result property="rectificationPerson" column="rectification_person" jdbcType="BIGINT"/>
- <result property="approvePerson" column="approve_person" jdbcType="BIGINT"/>
- <result property="rectificationDate" column="rectification_date" jdbcType="TIMESTAMP"/>
- <result property="content" column="content" jdbcType="VARCHAR"/>
- <result property="type" column="type" jdbcType="INTEGER"/>
- <result property="state" column="state" jdbcType="INTEGER"/>
- <result property="overtime" column="overtime" jdbcType="INTEGER"/>
- <result property="ishandle" column="ishandle" jdbcType="INTEGER"/>
- <result property="isexamine" column="isexamine" jdbcType="INTEGER"/>
- <result property="passDate" column="pass_date" jdbcType="TIMESTAMP"/>
- <result property="position" column="position" jdbcType="VARCHAR"/>
- <result property="projectId" column="project_id" jdbcType="BIGINT"/>
- </resultMap>
- <select id="pagelist" resultType="com.zhgd.scs.domain.vo.HidWorklistVo">
- SELECT w.*,su1.real_name createdPersonName,su2.real_name rectificationPersonName
- FROM hid_worklist w
- left join sys_user su1 on w.created_person = su1.id
- left join sys_user su2 on w.rectification_person = su2.id
- WHERE w.project_id = #{projectId} and w.fid IS NULL
- <if test="startDate!= null and endDate!= null ">
- AND (w.rectification_date between #{startDate} AND #{endDate} or w.created_date between #{startDate} AND #{endDate})
- </if>
- <if test="type!= null">
- AND w.type = #{type}
- </if>
- <if test="state!= null">
- AND w.state = #{state}
- </if>
- <if test="isEnd!= null">
- AND w.is_end = #{isEnd}
- </if>
- <if test="overtime!= null">
- AND w.overtime = #{overtime}
- </if>
- <if test="createdPerson!= null">
- AND w.created_person = #{createdPerson}
- </if>
- <if test="rectificationPerson!= null">
- AND w.rectification_person = #{rectificationPerson}
- </if>
- <if test="approvePerson!= null">
- AND w.approve_person = #{approvePerson}
- </if>
- <if test="allPerson!= null">
- AND( w.created_person = #{allPerson} or w.rectification_person = #{allPerson} or w.approve_person = #{allPerson})
- </if>
- <if test="worklistId!= null">
- AND w.id < #{worklistId}
- </if>
- ORDER BY
- # CASE WHEN w.state = 3 THEN 1 ELSE 0 END, -- 先按 state=3 排序
- w.created_date DESC,w.id DESC -- 然后按 time 倒序排序
- </select>
- <select id="groupType" resultType="com.zhgd.scs.domain.vo.NameValue">
- select
- a.type name,
- count(a.id) value
- FROM
- hid_worklist a
- where a.project_id = #{projectId} and a.fid IS NULL
- <if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
- and (a.created_date between #{startDate} and #{endDate}
- or date(a.created_date) = #{endDate})
- </if>
- GROUP BY name
- </select>
- <select id="getRectificationIds" resultType="java.lang.Long">
- select id from hid_worklist
- where fid = #{id}
- </select>
- </mapper>
|