学年管理-新增模块标签

This commit is contained in:
2025-11-28 16:35:00 +08:00
parent c0fca88261
commit 6895fdb185
7 changed files with 270 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="id" />
<result property="stuYearName" column="stu_year_name" />
<result property="xndm" column="xndm" />
<result property="moduleTags" column="module_tags"/>
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="delFlag" column="del_flag" />
@@ -18,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSrsStuYearVo">
select id,xndm, stu_year_name, start_time, end_time, del_flag,status, create_by, create_time, update_by, update_time from srs_stu_year
select id,xndm, stu_year_name,module_tags, start_time, end_time, del_flag,status, create_by, create_time, update_by, update_time from srs_stu_year
</sql>
<select id="selectSrsStuYearList" parameterType="SrsStuYear" resultMap="SrsStuYearResult">
@@ -50,6 +51,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectQiYongList" resultType="com.srs.comprehensive.domain.SrsStuYear">
select id,stu_year_name from srs_stu_year where status in (1,3) order by stu_year_name desc
</select>
<!-- 根据标签查询学年 -->
<!-- 根据标签查询学年(精确匹配) -->
<select id="selectYearsByTag" parameterType="string" resultMap="SrsStuYearResult">
<include refid="selectSrsStuYearVo"/>
where module_tags = #{tag}
or module_tags like concat(#{tag}, ',%')
or module_tags like concat('%,', #{tag}, ',%')
or module_tags like concat('%,', #{tag})
</select>
<!-- 获取包含指定标签的所有学年(用于标签移除) -->
<select id="getYearsContainingTag" parameterType="string" resultMap="SrsStuYearResult">
<include refid="selectSrsStuYearVo"/>
where module_tags = #{tag}
or module_tags like concat(#{tag}, ',%')
or module_tags like concat('%,', #{tag}, ',%')
or module_tags like concat('%,', #{tag})
</select>
<!-- 直接移除指定标签 -->
<update id="removeTagDirectly" parameterType="string">
UPDATE srs_stu_year
SET module_tags = CASE
WHEN module_tags = #{tag} THEN NULL
WHEN module_tags LIKE concat(#{tag}, ',%') THEN REPLACE(module_tags, concat(#{tag}, ','), '')
WHEN module_tags LIKE concat('%,', #{tag}) THEN REPLACE(module_tags, concat(',', #{tag}), '')
WHEN module_tags LIKE concat('%,', #{tag}, ',%') THEN REPLACE(module_tags, concat(',', #{tag}, ','), ',')
ELSE module_tags
END
WHERE module_tags = #{tag}
OR module_tags LIKE concat(#{tag}, ',%')
OR module_tags LIKE concat('%,', #{tag})
OR module_tags LIKE concat('%,', #{tag}, ',%')
</update>
<!-- 获取所有包含标签的学年 -->
<select id="getYearsWithTags" resultMap="SrsStuYearResult">
<include refid="selectSrsStuYearVo"/>
where module_tags is not null and module_tags != ''
</select>
<insert id="insertSrsStuYear" parameterType="SrsStuYear">
insert into srs_stu_year
@@ -57,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="id != null">id,</if>
<if test="xndm != null">xndm,</if>
<if test="stuYearName != null">stu_year_name,</if>
<if test="moduleTags != null ">module_tags,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="status != null">`status`,</if>
@@ -70,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="id != null">#{id},</if>
<if test="xndm != null">#{xndm},</if>
<if test="stuYearName != null">#{stuYearName},</if>
<if test="moduleTags != null">#{moduleTags},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="status != null">#{status},</if>
@@ -86,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="xndm != null">xndm = #{xndm},</if>
<if test="stuYearName != null">stu_year_name = #{stuYearName},</if>
module_tags = #{moduleTags},
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>