2024-11-16 12:17:07 +08:00
|
|
|
<?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.zsc.edu.gateway.modules.notice.repo.BulletinRepository">
|
2024-11-26 16:16:08 +08:00
|
|
|
<resultMap id="BulletinMap" type="com.zsc.edu.gateway.modules.notice.vo.BulletinVo" autoMapping="true">
|
2024-11-16 12:17:07 +08:00
|
|
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
|
|
|
<result column="title" jdbcType="VARCHAR" property="title"/>
|
|
|
|
<result column="state" jdbcType="INTEGER" property="state"/>
|
|
|
|
<result column="top" jdbcType="BOOLEAN" property="top"/>
|
|
|
|
<result column="edit_time" jdbcType="TIMESTAMP" property="editTime"/>
|
|
|
|
<result column="publish_time" jdbcType="TIMESTAMP" property="publishTime"/>
|
|
|
|
<result column="close_time" jdbcType="TIMESTAMP" property="closeTime"/>
|
|
|
|
<result column="content" jdbcType="VARCHAR" property="content"/>
|
|
|
|
<result column="edit_user_id" jdbcType="BIGINT" property="editUserId"/>
|
|
|
|
<result column="publish_user_id" jdbcType="BIGINT" property="publishUserId"/>
|
|
|
|
<result column="close_user_id" jdbcType="BIGINT" property="closeUserId"/>
|
|
|
|
<result column="edit_user_name" jdbcType="VARCHAR" property="editUsername"/>
|
|
|
|
<result column="publish_user_name" jdbcType="VARCHAR" property="publishUsername"/>
|
|
|
|
<result column="close_user_name" jdbcType="VARCHAR" property="closeUsername"/>
|
2024-12-06 13:09:20 +08:00
|
|
|
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
|
|
|
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
|
|
|
|
<result column="create_time" jdbcType="DATE" property="createTime"/>
|
|
|
|
<result column="update_time" jdbcType="DATE" property="updateTime"/>
|
|
|
|
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
|
|
|
<collection property="attachmentVos" ofType="com.zsc.edu.gateway.modules.attachment.vo.AttachmentVo"
|
|
|
|
autoMapping="true" columnPrefix="attachment_">
|
|
|
|
<id column="id" property="attachmentId"/>
|
2024-12-02 16:26:23 +08:00
|
|
|
<result column="file_name" jdbcType="VARCHAR" property="fileName"/>
|
|
|
|
<result column="url" jdbcType="VARCHAR" property="url"/>
|
|
|
|
</collection>
|
2024-11-16 12:17:07 +08:00
|
|
|
</resultMap>
|
|
|
|
<select id="selectByBulletinId" resultMap="BulletinMap">
|
2024-12-06 13:09:20 +08:00
|
|
|
SELECT sb.*, a.id as attachment_id, a.file_name as attachment_file_name, a.url as attachment_url
|
2024-12-02 16:26:23 +08:00
|
|
|
FROM sys_bulletin sb
|
|
|
|
LEFT JOIN
|
|
|
|
sys_bulletin_attach sba ON sb.id = sba.bulletin_id
|
|
|
|
LEFT JOIN
|
|
|
|
attachment a ON a.id = sba.attachment_id
|
|
|
|
WHERE sb.id = #{bulletinId}
|
|
|
|
|
2024-11-28 16:05:34 +08:00
|
|
|
</select>
|
2024-11-16 12:17:07 +08:00
|
|
|
|
2024-11-28 16:05:34 +08:00
|
|
|
<select id="selectPageByConditions" resultType="com.zsc.edu.gateway.modules.notice.vo.BulletinVo">
|
2024-12-02 16:26:23 +08:00
|
|
|
SELECT
|
|
|
|
sb.id AS id,
|
|
|
|
sb.state AS state,
|
|
|
|
sb.content AS content,
|
|
|
|
sb.title AS title,
|
|
|
|
sb.top AS top,
|
|
|
|
sb.remark AS remark,
|
|
|
|
sb.close_time AS close_time,
|
|
|
|
sb.close_user_id AS close_user_id,
|
|
|
|
sb.create_by AS create_by,
|
|
|
|
sb.create_time AS create_time,
|
|
|
|
sb.edit_user_id AS edit_user_id,
|
|
|
|
sb.publish_time AS publish_time,
|
|
|
|
sb.publish_user_id AS publish_user_id,
|
|
|
|
sb.update_by AS update_by,
|
|
|
|
sb.update_time AS update_time,
|
2024-12-06 13:09:20 +08:00
|
|
|
a.id AS id,
|
2024-12-02 16:26:23 +08:00
|
|
|
a.file_name AS file_name,
|
|
|
|
a.url AS url
|
|
|
|
FROM
|
|
|
|
sys_bulletin sb
|
|
|
|
LEFT JOIN
|
|
|
|
sys_bulletin_attach sba ON sb.id = sba.bulletin_id
|
|
|
|
LEFT JOIN
|
|
|
|
attachment a ON a.id = sba.attachment_id
|
|
|
|
where 1=1
|
2024-11-28 16:05:34 +08:00
|
|
|
<if test="query.title != null and query.title != ''">
|
|
|
|
AND sb.title LIKE CONCAT('%', #{query.title}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="query.state != null">
|
|
|
|
AND sb.state = #{query.state}
|
|
|
|
</if>
|
|
|
|
<if test="query.publishTimeBegin != null and query.publishTimeEnd != null">
|
|
|
|
AND sb.publish_time BETWEEN #{query.publishTimeBegin} AND #{query.publishTimeEnd}
|
|
|
|
</if>
|
|
|
|
order by sb.top DESC,sb.publish_time DESC,sb.create_time DESC
|
2024-11-16 12:17:07 +08:00
|
|
|
</select>
|
|
|
|
</mapper>
|