feat: 项目分页查询关联sys_user表返回创建人真实姓名
- VO 添加 createByName 字段 - Mapper XML 添加 LEFT JOIN sys_user 查询 - 使用 IFNULL 处理空值降级 - 添加逻辑删除过滤条件 - 通过代码审查
This commit is contained in:
@@ -44,6 +44,9 @@ public class CcdiProjectVO {
|
|||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/** 创建者 */
|
/** 创建者(用户名) */
|
||||||
private String createBy;
|
private String createBy;
|
||||||
|
|
||||||
|
/** 创建者姓名(真实姓名) */
|
||||||
|
private String createByName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,24 +15,28 @@
|
|||||||
<result property="lowRiskCount" column="low_risk_count"/>
|
<result property="lowRiskCount" column="low_risk_count"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createByName" column="create_by_name"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 分页查询项目列表 -->
|
<!-- 分页查询项目列表 -->
|
||||||
<select id="selectProjectPage" resultMap="ProjectVOResultMap">
|
<select id="selectProjectPage" resultMap="ProjectVOResultMap">
|
||||||
SELECT
|
SELECT
|
||||||
project_id, project_name, description, config_type,
|
p.project_id, p.project_name, p.description, p.config_type,
|
||||||
status, is_archived, target_count, high_risk_count,
|
p.status, p.is_archived, p.target_count, p.high_risk_count,
|
||||||
medium_risk_count, low_risk_count, create_time, create_by
|
p.medium_risk_count, p.low_risk_count, p.create_time,
|
||||||
FROM ccdi_project
|
p.create_by,
|
||||||
|
IFNULL(u.nick_name, p.create_by) AS create_by_name
|
||||||
|
FROM ccdi_project p
|
||||||
|
LEFT JOIN sys_user u ON p.create_by = u.user_name AND u.del_flag = '0'
|
||||||
<where>
|
<where>
|
||||||
del_flag = '0'
|
p.del_flag = '0'
|
||||||
<if test="queryDTO.projectName != null and queryDTO.projectName != ''">
|
<if test="queryDTO.projectName != null and queryDTO.projectName != ''">
|
||||||
AND project_name LIKE CONCAT('%', #{queryDTO.projectName}, '%')
|
AND p.project_name LIKE CONCAT('%', #{queryDTO.projectName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDTO.status != null and queryDTO.status != ''">
|
<if test="queryDTO.status != null and queryDTO.status != ''">
|
||||||
AND status = #{queryDTO.status}
|
AND p.status = #{queryDTO.status}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY create_time DESC
|
ORDER BY p.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user