gunshi-project-ss/src/main/resources/mapper/SysDictBMapper.xml

98 lines
3.5 KiB
XML
Raw Normal View History

2024-01-24 14:27:40 +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.gunshi.project.xyt.mapper.SysDictBMapper">
<resultMap id="BaseResultMap" type="com.gunshi.project.xyt.model.SysDictB">
<!--@mbg.generated-->
<!--@Table dbo.SYS_DICT_B-->
<id column="ID" jdbcType="BIGINT" property="id" />
<result column="DICT_NM" jdbcType="VARCHAR" property="dictNm" />
<result column="DICT_CD" jdbcType="VARCHAR" property="dictCd" />
<result column="PID" jdbcType="BIGINT" property="pid" />
<result column="SORT_ON" jdbcType="INTEGER" property="sortOn" />
<result column="CREATE_TM" jdbcType="TIMESTAMP" property="createTm" />
<result column="TM" jdbcType="TIMESTAMP" property="tm" />
<result column="STATUS" jdbcType="INTEGER" property="status" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
ID, DICT_NM, DICT_CD, PID, SORT_ON, CREATE_TM, TM, [STATUS]
</sql>
<insert id="batchInsert" parameterType="map">
<!--@mbg.generated-->
insert into dbo.SYS_DICT_B
(ID, DICT_NM, DICT_CD, PID, SORT_ON, CREATE_TM, TM, [STATUS])
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=BIGINT}, #{item.dictNm,jdbcType=VARCHAR}, #{item.dictCd,jdbcType=VARCHAR},
#{item.pid,jdbcType=BIGINT}, #{item.sortOn,jdbcType=INTEGER}, #{item.createTm,jdbcType=TIMESTAMP},
#{item.tm,jdbcType=TIMESTAMP}, #{item.status,jdbcType=INTEGER})
</foreach>
</insert>
2024-01-25 15:57:07 +08:00
<select id="checkExistCodeAndName" resultType="boolean">
select case when
exists(select 1
from dbo.SYS_DICT_B where (DICT_NM = #{obj.dictNm} or DICT_CD = #{obj.dictCd})
and STATUS = 1
and PID = 0
<if test='obj.id != null'>
and ID != #{obj.id}
</if>
) then 1
else 0 end
</select>
<select id="queryPidBySearch" resultType="com.gunshi.project.xyt.model.SysDictB">
select ID from (
(select ID as ID
from SYS_DICT_B
<where>
<if test="obj.keyword != null and obj.keyword != ''">
and (DICT_NM like concat('%', #{obj.keyword}, '%') or DICT_CD like concat('%', #{obj.keyword}, '%'))
</if>
and PID = 0
and STATUS = 1
</where>
)
union
(select PID as ID
from SYS_DICT_B
<where>
<if test="obj.keyword != null and obj.keyword != ''">
and (DICT_NM like concat('%', #{obj.keyword}, '%') or DICT_CD like concat('%', #{obj.keyword}, '%'))
</if>
<![CDATA[
and PID <> 0]]>
and STATUS = 1
</where>
)
) temp_table
</select>
<select id="queryByPidOrIds" resultType="com.gunshi.project.xyt.entity.basedata.SysDictVo">
select
<include refid="Base_Column_List"/>
from SYS_DICT_B a
<where>
PID in
<foreach item="it" collection="obj" separator="," open="(" close=")">
#{it}
</foreach>
or ID in
<foreach item="it" collection="obj" separator="," open="(" close=")">
#{it}
</foreach>
and STATUS = 1
2024-01-25 15:57:07 +08:00
</where>
order by SORT_ON
</select>
<select id="getAll" resultType="com.gunshi.project.xyt.entity.basedata.SysDictVo">
select
<include refid="Base_Column_List"/>
from SYS_DICT_B a
<where>
and STATUS = 1
</where>
</select>
2024-01-24 14:27:40 +08:00
</mapper>