文章素材路线管理mapper

This commit is contained in:
温文静WWW 2025-07-11 19:33:54 +08:00
parent 051a8a660a
commit efd2c05ba7
6 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<?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.aircraft.modules.article.mapper.CpArticleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.aircraft.modules.article.domain.CpArticle">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="title" property="title" jdbcType="VARCHAR"/>
<result column="photo" property="photo" jdbcType="VARCHAR"/>
<result column="textid" property="textid" jdbcType="BIGINT"/>
<result column="article_type" property="articleType" jdbcType="INTEGER"/>
<result column="url" property="url" jdbcType="VARCHAR"/>
<result column="cplabel_id" property="cplabelId" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="author_id" property="authorId" jdbcType="BIGINT"/>
<result column="check_state" property="checkState" jdbcType="CHAR"/>
<result column="del_flag" property="delFlag" jdbcType="INTEGER"/>
</resultMap>
<update id="updateDelFlagById">
UPDATE cp_article
SET del_flag = #{delFlag}
WHERE id = #{id}
AND del_flag = 0 <!-- 确保只更新未删除的记录 -->
</update>
</mapper>

View File

@ -0,0 +1,34 @@
<?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.aircraft.modules.article.mapper.CpLabelMapper">
<!-- 查询标签树(扁平结构) -->
<select id="selectLabelTreeByModuleId" resultType="com.aircraft.modules.article.domain.dto.CpLabelVo">
SELECT
l.id,
l.name,
l.level,
l.parent_id AS parentId,
l.module_id AS moduleId,
m.module_name AS moduleName
FROM cp_label l
LEFT JOIN cp_module m ON l.module_id = m.id
WHERE l.module_id = #{moduleId}
AND l.del_flag = 0
ORDER BY l.parent_id, l.order_num
</select>
<!-- 查询子标签 -->
<select id="selectChildrenByParentId" resultType="com.aircraft.modules.article.domain.CpLabel">
SELECT * FROM cp_label
WHERE parent_id = #{parentId}
AND del_flag = 0
ORDER BY order_num
</select>
<update id="updateDelFlagById">
UPDATE cp_label
SET del_flag = #{delFlag}
WHERE id = #{id}
AND del_flag = 0 <!-- 确保只更新未删除的记录 -->
</update>
</mapper>

View File

@ -0,0 +1,13 @@
<?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.aircraft.modules.article.mapper.CpMaterialMapper">
<update id="updateDelFlagById">
UPDATE cp_material
SET
del_flag = #{delFlag},
update_time = NOW() <!-- 添加更新日期:使用数据库当前时间 -->
WHERE
id = #{id}
AND del_flag = 0 <!-- 仅更新未删除的记录 -->
</update>
</mapper>

View File

@ -0,0 +1,10 @@
<?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.aircraft.modules.article.mapper.CpModuleMapper">
<update id="updateDelFlagById">
UPDATE cp_module
SET del_flag = #{delFlag}
WHERE id = #{id}
AND del_flag = 0 <!-- 确保只更新未删除的记录 -->
</update>
</mapper>

View File

@ -0,0 +1,5 @@
<?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.aircraft.modules.article.mapper.CpTextMapper">
</mapper>

View File

@ -0,0 +1,17 @@
<?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.aircraft.modules.route.mapper.CpRouteMapper">
<!-- 根据ID查询路线 -->
<select id="getRouteById" resultType="com.aircraft.modules.route.domain.CpRoute">
SELECT * FROM cp_route
WHERE id = #{id}
AND del_flag = 0 <!-- 仅查询未删除的路线 -->
</select>
<update id="updateDelFlagById">
UPDATE cp_route
SET del_flag = #{delFlag},
update_time=now()
WHERE id = #{id}
AND del_flag = 0 <!-- 确保只更新未删除的记录 -->
</update>
</mapper>