feat:角色接口开发v1

This commit is contained in:
xiang
2025-08-25 23:16:41 +08:00
parent 32783ecb0b
commit c6592f2e5d
8 changed files with 422 additions and 8 deletions

View File

@@ -0,0 +1,142 @@
<?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.xiang.xservice.auth.service.repository.mapper.XRoleMapper">
<resultMap id="BaseResultMap" type="com.xiang.xservice.auth.service.entity.XRole" >
<result column="id" property="id" />
<result column="name" property="name" />
<result column="code" property="code" />
<result column="status" property="status" />
<result column="data_scope" property="dataScope" />
<result column="created_time" property="createdTime" />
<result column="create_by" property="createBy" />
<result column="updated_time" property="updatedTime" />
<result column="update_by" property="updateBy" />
<result column="del_flag" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
id,
name,
code,
status,
data_scope,
created_time,
create_by,
updated_time,
update_by,
del_flag
</sql>
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.xiang.xservice.auth.service.entity.XRole">
INSERT INTO x_role
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != name and '' != name">
name,
</if>
<if test="null != code and '' != code">
code,
</if>
<if test="null != status ">
status,
</if>
<if test="null != dataScope ">
data_scope,
</if>
<if test="null != createdTime ">
created_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updatedTime ">
updated_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != delFlag ">
del_flag
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != code and '' != code">
#{code},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != dataScope ">
#{dataScope},
</if>
<if test="null != createdTime ">
#{createdTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updatedTime ">
#{updatedTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != delFlag ">
#{delFlag}
</if>
</trim>
</insert>
<update id="delBatch" >
update x_role set del_flag = 0, update_time = #{time}, update_by = #{operator} where id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</update>
<update id="update" parameterType="com.xiang.xservice.auth.service.entity.XRole">
UPDATE x_role
<set>
<if test="null != name and '' != name">name = #{name},</if>
<if test="null != code and '' != code">code = #{code},</if>
<if test="null != status ">status = #{status},</if>
<if test="null != dataScope ">data_scope = #{dataScope},</if>
<if test="null != createdTime ">created_time = #{createdTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != updatedTime ">updated_time = #{updatedTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != delFlag ">del_flag = #{delFlag}</if>
</set>
WHERE id = #{id}
</update>
<select id="getRoleById" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from x_role
where id = #{id}
</select>
<select id="getRoleList" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from x_role
<trim prefix="AND">
<if test="name != null and name != ''">
AND name = #{name}
</if>
<if test="code != null and code != ''">
AND code = #{code}
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="dataScope != null">
AND data_scope = #{dataScope}
</if>
</trim>
</select>
</mapper>