<?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.ycl.mapper.ReportMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.ycl.domain.vo.ReportVO">
|
<result column="content" property="content" />
|
<result column="project_id" property="projectId" />
|
<result column="project_name" property="projectName" />
|
<result column="user_id" property="userId" />
|
<result column="file_url" property="fileUrl"/>
|
<result column="user_name" property="userName"/>
|
<result column="status" property="status"/>
|
<result column="remake" property="remake"/>
|
</resultMap>
|
|
<select id="getById" resultMap="BaseResultMap">
|
SELECT
|
TR.content,
|
TR.project_id,
|
TR.project_name,
|
TR.user_id,
|
TR.id
|
FROM
|
t_report TR
|
WHERE
|
TR.id = #{id} AND TR.deleted = 0
|
</select>
|
|
|
<select id="getPage" resultMap="BaseResultMap">
|
SELECT
|
TR.user_id,
|
TR.content,
|
TR.status,
|
TR.file_url,
|
TR.project_id,
|
TR.project_name,
|
TR.gmt_create,
|
TR.gmt_update,
|
SU.user_name,
|
TR.remake,
|
TR.id
|
FROM
|
t_report TR
|
LEFT JOIN
|
sys_user SU on TR.user_id = SU.user_id
|
WHERE
|
TR.deleted = 0
|
<if test="query.projectName !=null and query.projectName !=''">
|
and TR.project_name like concat('%', #{query.projectName}, '%')
|
</if>
|
<if test="query.startTime != null">
|
and TR.gmt_create >= #{query.startTime}
|
</if>
|
<if test="query.endTime != null">
|
and TR.gmt_create <= #{query.startTime}
|
</if>
|
<if test="query.status != null and query.status !=''">
|
and TR.status = #{query.status}
|
</if>
|
order by TR.gmt_create desc
|
</select>
|
|
|
<select id="groupByProjectAndDate" resultMap="BaseResultMap">
|
|
SELECT
|
TR.content,
|
TR.project_id,
|
TR.project_name,
|
TR.user_id,
|
TR.id,
|
TR.gmt_create,
|
TR.file_url,
|
TR.status
|
FROM
|
t_report TR
|
LEFT JOIN t_project_info TPI on TR.project_id = TPI.id
|
WHERE
|
TR.deleted = 0
|
AND TR.gmt_create BETWEEN #{startTime} AND #{endTime}
|
<if test="projectId != null">
|
AND TR.project_id = #{projectId}
|
</if>
|
</select>
|
|
</mapper>
|