You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.2 KiB
XML

5 years ago
<?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.glxp.udi.admin.dao.auth.AuthRoleDao">
<select id="listAdminPage" parameterType="com.glxp.udi.admin.req.auth.AuthRoleQueryRequest"
resultType="com.glxp.udi.admin.entity.auth.AuthRole">
SELECT id,name,status,remark,create_time,listorder,isCustomer
FROM auth_role
<where>
<if test="status != null">
AND status = #{status}
</if>
<if test="name != null and '' != name">
AND `name` LIKE CONCAT(#{name},'%')
</if>
</where>
</select>
<select id="listAuthAdminRolePage" resultType="com.glxp.udi.admin.entity.auth.AuthRole">
SELECT id,name
FROM auth_role
<where>
<if test="status != null">
AND status = #{status}
</if>
</where>
</select>
<select id="findByName" resultType="com.glxp.udi.admin.entity.auth.AuthRole">
SELECT *
FROM auth_role
where `name` = #{name}
</select>
<select id="listCustomerRoles" parameterType="java.lang.Integer" resultType="com.glxp.udi.admin.entity.auth.AuthRole">
SELECT id,name
FROM auth_role
where `isCustomer` = #{isCustomer}
</select>
<select id="findById" parameterType="java.lang.Long" resultType="com.glxp.udi.admin.entity.auth.AuthRole">
SELECT *
FROM auth_role
where `id` = #{id}
</select>
<insert id="insertAuthRole" keyProperty="id" parameterType="com.glxp.udi.admin.entity.auth.AuthRole">
INSERT INTO auth_role(`name`,pid,`status`,`remark`,`listorder`,create_time,update_time,isCustomer)
values
(
#{name},
<choose>
<when test="pid != null">
#{pid},
</when>
<otherwise>
0,
</otherwise>
</choose>
#{status},
<choose>
<when test="remark != null">
#{remark},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when test="listorder != null">
#{listorder},
</when>
<otherwise>
999,
</otherwise>
</choose>
#{createTime},
#{updateTime},
#{isCustomer}
)
</insert>
<update id="updateAuthRole" parameterType="com.glxp.udi.admin.entity.auth.AuthRole">
UPDATE auth_role
<set>
<if test="name != null">`name`=#{name},</if>
<if test="pid != null">pid=#{pid},</if>
<if test="status != null">`status`=#{status},</if>
<if test="remark != null">remark=#{remark},</if>
<if test="listorder != null">`listorder`=#{listorder},</if>
<if test="updateTime != null">update_time=#{updateTime},</if>
<if test="isCustomer != null">isCustomer=#{isCustomer},</if>
</set>
WHERE id=#{id}
</update>
<delete id="deleteById" parameterType="java.lang.Long">
delete from auth_role where id = #{id}
</delete>
</mapper>