defence_strong_enemy/target/classes/mapper/CodeOptionMapper.xml
2025-07-23 16:29:53 +08:00

72 lines
2.4 KiB
XML

<?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.hshh.nation.code.mapper.CodeOptionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hshh.nation.code.entity.CodeOption">
<id column="id" property="id" />
<result column="dict_id" property="dictId" />
<result column="option_name" property="optionName" />
<result column="option_value" property="optionValue" />
<result column="option_order" property="optionOrder" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, dict_id, option_name, option_value, option_order
</sql>
<select id="list" resultType="com.hshh.nation.code.entity.CodeOption" parameterType="com.hshh.nation.code.entity.CodeOption">
SELECT
@rownum := @rownum + 1 AS seq,
t.*
FROM (
SELECT * FROM sys_code_option
<where>
<if test="model.optionName != null and model.optionName !='' ">
option_name like CONCAT('%', #{model.optionName}, '%')
</if>
<if test="model.dictId != null">
dict_id = #{model.dictId}
</if>
</where>
order by id,dict_id asc ) t, ( SELECT @rownum := #{model.start} ) r limit #{model.start},#{model.pageSize}
</select>
<select id="list" resultType="com.hshh.nation.code.entity.CodeOption" parameterType="com.hshh.nation.code.entity.CodeOption" databaseId="dm">
SELECT
t.seq,
t.*
FROM (
SELECT
ROW_NUMBER() OVER (ORDER BY id ASC) AS seq,
a.* FROM sys_code_option a
<where>
<if test="model.optionName != null and model.optionName !='' ">
option_name like '%'|| #{model.optionName}||'%'
</if>
<if test="model.dictId != null">
dict_id = #{model.dictId}
</if>
</where>
) t
WHERE t.seq > #{model.start} AND t.seq &lt;= (#{model.start} + #{model.pageSize})
</select>
<select id="count" resultType="java.lang.Long">
select count(id) from sys_code_option
<where>
<if test="model.optionName != null and model.optionName !='' ">
option_name like CONCAT('%', #{model.optionName}, '%')
</if>
<if test="model.dictId != null">
dict_id = #{model.dictId}
</if>
</where>
</select>
</mapper>