字典类型加上组织字段

This commit is contained in:
秦鸿展
2026-05-14 14:18:51 +08:00
parent c7c536782f
commit f8c6be9db8
11 changed files with 289 additions and 35 deletions
@@ -58,6 +58,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="topOrganizationId != null">
and (top_organization_id = #{topOrganizationId} OR is_default = 'Y')
</if>
<if test="organizationId != null">
and (IFNULL(organization_id, 0) = #{organizationId} OR is_default = 'Y')
</if>
</where>
order by dict_sort asc
</select>
@@ -73,7 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="countDictDataByType" resultType="Integer">
select count(1) from sys_dict_data where dict_type=#{dictType}
select count(1) from sys_dict_data
where dict_type = #{dictType}
and IFNULL(organization_id, 0) = IFNULL(#{organizationId}, 0)
</select>
<delete id="deleteDictDataById" parameterType="Long">
@@ -108,8 +113,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where dict_code = #{dictCode}
</update>
<update id="updateDictDataType" parameterType="String">
update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
<update id="updateDictDataType">
update sys_dict_data set dict_type = #{newDictType}
where dict_type = #{oldDictType}
and IFNULL(organization_id, 0) = IFNULL(#{organizationId}, 0)
</update>
<update id="updateDictDataOrganizationByDictType">
update sys_dict_data
set organization_id = #{organizationId},
organization_name = #{organizationName},
top_organization_id = #{topOrganizationId},
update_time = sysdate()
where dict_type = #{dictType}
and IFNULL(organization_id, 0) = IFNULL(#{scopeOrganizationId}, 0)
</update>
<insert id="insertDictData" parameterType="SysDictData">
@@ -13,10 +13,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
</resultMap>
<sql id="selectDictTypeVo">
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
select dict_id, dict_name, dict_type, status, create_by, create_time, remark,
organization_id, organization_name, top_organization_id
from sys_dict_type
</sql>
@@ -32,6 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dictType != null and dictType != ''">
AND dict_type like concat('%', #{dictType}, '%')
</if>
<if test="organizationId != null">
AND organization_id = #{organizationId}
</if>
<if test="topOrganizationId != null">
AND (top_organization_id = #{topOrganizationId} OR IFNULL(organization_id, 0) = 0)
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
@@ -53,11 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType}
order by (IFNULL(organization_id, 0) = 0) desc, dict_id asc
limit 1
</select>
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
<select id="checkDictTypeUnique" parameterType="SysDictType" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType} limit 1
where dict_type = #{dictType}
and IFNULL(organization_id, 0) = IFNULL(#{organizationId}, 0)
limit 1
</select>
<delete id="deleteDictTypeById" parameterType="Long">
@@ -78,6 +93,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="organizationId != null">organization_id = #{organizationId},</if>
<if test="organizationName != null">organization_name = #{organizationName},</if>
<if test="topOrganizationId != null">top_organization_id = #{topOrganizationId},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
@@ -90,6 +108,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="organizationId != null">organization_id,</if>
<if test="organizationName != null and organizationName != ''">organization_name,</if>
<if test="topOrganizationId != null">top_organization_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
@@ -97,6 +118,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="organizationId != null">#{organizationId},</if>
<if test="organizationName != null and organizationName != ''">#{organizationName},</if>
<if test="topOrganizationId != null">#{topOrganizationId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)