<?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.dg.core.db.gen.mapper.RoleManagementMapper">
|
|
<resultMap type="com.dg.core.db.gen.entity.RoleManagementEntity" id="RoleManagementEntityResult">
|
<id property="id" column="id" />
|
<id property="roleName" column="role_name" />
|
<id property="createUserId" column="create_user_id" />
|
<id property="createTime" column="create_time" />
|
<id property="updateUserId" column="update_user_id" />
|
<id property="updateTime" column="update_time" />
|
<id property="permission" column="permission" />
|
|
</resultMap>
|
|
<sql id="selectRoleManagementEntityVo">
|
SELECT
|
id,
|
role_name,
|
permission,
|
create_time,
|
update_time,
|
create_user_id,
|
(select user_name from automessage_sys_user where create_user_id=automessage_sys_user.user_id) as createName,
|
update_user_id
|
FROM
|
automessage_role_management
|
</sql>
|
|
<select id="selectConfigList" resultMap="RoleManagementEntityResult">
|
<include refid="selectRoleManagementEntityVo"/>
|
<where>
|
AND id not in(1,2,3,4)
|
<if test="name!=null and name!=''">
|
and role_name like concat('%', #{name}, '%')
|
</if>
|
<!-- <if test="streetName != null and streetName != ''">-->
|
-- AND id not in(1,2,3,4)
|
<!-- </if>-->
|
<!-- <if test="loginName != null and loginName != ''">-->
|
<!-- AND login_name like concat('%', #{loginName}, '%')-->
|
<!-- </if>-->
|
<!-- <if test="phonenumber != null and phonenumber != ''">-->
|
<!-- AND phonenumber like concat('%', #{phonenumber}, '%')-->
|
<!-- </if>-->
|
<!-- <if test="roleId != null and roleId != ''">-->
|
<!-- AND role_id=#{roleId}-->
|
<!-- </if>-->
|
|
</where>
|
|
order by create_time desc
|
</select>
|
|
<insert id="insertConfig" parameterType="com.dg.core.db.gen.entity.RoleManagementEntity">
|
insert into automessage_role_management (
|
<if test="id != null">id,</if>
|
<if test="roleName != null and roleName != '' ">role_name,</if>
|
<if test="permission != null">permission,</if>
|
<if test="createUserId != null and createUserId != '' ">create_user_id,</if>
|
<if test="updateUserId != null and updateUserId != '' ">update_user_id,</if>
|
update_time,
|
create_time
|
)values(
|
<if test="id != null">#{id},</if>
|
<if test="roleName != null and roleName != '' ">#{roleName},</if>
|
<if test="permission != null and permission != '' " >#{permission},</if>
|
<if test="createUserId != null and createUserId != '' ">#{createUserId},</if>
|
<if test="updateUserId != null and updateUserId != '' ">#{updateUserId},</if>
|
sysdate(),
|
sysdate()
|
)
|
</insert>
|
|
<update id="updateConfig" parameterType="com.dg.core.db.gen.entity.RoleManagementEntity">
|
update automessage_role_management
|
<set>
|
<if test="id != null">id=#{id},</if>
|
<if test="roleName != null and roleName != '' ">role_name=#{roleName},</if>
|
<if test="permission != null and permission != '' " >permission=#{permission},</if>
|
<if test="createUserId != null and createUserId != '' ">create_user_id=#{createUserId},</if>
|
<if test="updateUserId != null and updateUserId != '' ">update_user_id=#{updateUserId},</if>
|
update_time=sysdate()
|
</set>
|
where id= #{id}
|
</update>
|
|
<delete id="deleteConfigById" parameterType="string">
|
delete from automessage_role_management where id= #{Id}
|
</delete>
|
|
<select id="countNum" resultType="integer">
|
select count(id) from automessage_role_management
|
<where>
|
<if test="name!=null and name!=''">
|
and role_name like concat('%', #{name}, '%')
|
</if>
|
</where>
|
</select>
|
|
</mapper>
|