54 lines
2.2 KiB
XML
Raw Normal View History

2025-06-11 17:46:57 +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="cc.iteachyou.cms.dao.LabelMapper" >
<resultMap id="BaseResultMap" type="cc.iteachyou.cms.entity.Label" >
<id column="id" property="id" jdbcType="VARCHAR" />
<result column="tag_name" property="tagName" jdbcType="VARCHAR" />
<result column="tag_count" property="tagCount" jdbcType="VARCHAR" />
<result column="pinyin" property="pinyin" jdbcType="VARCHAR" />
<result column="first_char" property="firstChar" jdbcType="VARCHAR" />
<result column="create_by" property="createBy" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_by" property="updateBy" jdbcType="VARCHAR" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, tag_name, tag_count, pinyin, first_char, create_by, create_time, update_by, update_time
</sql>
<select id="selectByLabelName" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from system_labels
where tag_name = #{tagName,jdbcType=VARCHAR}
</select>
<select id="queryGroup" resultType="java.lang.String">
SELECT DISTINCT first_char FROM `system_labels` order by first_char
</select>
<select id="queryLabelByGroup" resultType="java.util.HashMap">
select id,tag_name as 'tagName',tag_count as 'tagCount',CONCAT(FLOOR((RAND() * 7)),'') AS cls from system_labels
where first_char=#{firstChar,jdbcType=VARCHAR}
</select>
<delete id="deleteByTagName" parameterType="java.lang.String" >
delete from system_labels
where tag_name = #{tagName,jdbcType=VARCHAR}
</delete>
<select id="queryAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from system_labels
order by tag_count desc
</select>
<select id="queryLabelByPage" parameterType="java.util.Map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from system_labels
order by tag_count desc
</select>
</mapper>