@ -2,13 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace= "com.example.demo.mapper.PermissionMapper" >
<insert id= "addPermission" useGeneratedKeys= "true" keyProperty= "id" keyColumn= "id" >
insert into admin(admin_name,machine_id,account,password,market,postiton,remark,admin_status)
values(#{adminName},#{machineId},#{account},#{password},#{market[0]},#{postiton},#{remark},1)
</insert>
<insert id= "addadminRole" >
insert into admin_role(admin_id,role_id)
values(#{adminId},#{roleId})
insert into admin(admin_name, machine_id, account, password, market, postiton, remark, admin_status, role_id)
values (#{adminName}, #{machineId}, #{account}, #{password}, #{market[0]}, #{postiton}, #{remark}, 1 ,#{roleId})
</insert>
<!-- <insert id="addadminRole"> -->
<!-- insert into admin_role(admin_id, role_id) -->
<!-- values (#{adminId}, #{roleId}) -->
<!-- </insert> -->
<update id= "updatePermission" >
update admin
<set >
@ -19,13 +19,13 @@
where id=#{id}
</update>
<update id= "updateAdminRole" >
update admin_role
update admin
<set >
<if test= "roleId!=null" >
role_id= #{roleId},
</if>
</set>
where admin_ id= #{id}
where id= #{adm inI d}
</update>
<update id= "updateAdmin" >
@ -49,19 +49,27 @@
</update>
<delete id= "deleteAdmin" >
delete from admin where id=#{id}
</delete>
<delete id= "deleteAdminRole" >
delete from admin_role where admin_id= #{id}
delete
from admin
where id = #{id}
</delete>
<!-- <delete id="deleteAdminRole"> -->
<!-- delete -->
<!-- from admin_role -->
<!-- where admin_id = #{id} -->
<!-- </delete> -->
<select id= "getposition" resultType= "java.lang.String" >
select distinct postiton from admin
select distinct postiton
from admin
</select>
<select id= "getmarket" resultType= "java.lang.String" >
select distinct market from admin
select distinct market
from admin
</select>
<select id= "getPermission" resultType= "com.example.demo.domain.vo.Permission" >
select admin.id as id,admin.admin_name as name,admin.account,admin.market,admin.postiton,admin.remark,admin.admin_status as adminStatus,role.role_name as roleName,role.id as roleId
select admin.id as id,admin.admin_name as
name,admin.account,admin.market,admin.postiton,admin.remark,admin.admin_status as adminStatus,role.role_name as
roleName,role.id as roleId
from admin
left join role on admin.role_id=role.id
@ -80,7 +88,8 @@
order by admin.admin_status desc
</select>
<select id= "getRole" resultType= "com.example.demo.domain.entity.Role" >
select * from role
select *
from role
</select>
</mapper>