2019-02-27 00:00:37 +08:00
|
|
|
<?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="cn.iocoder.mall.admin.dao.AdminRoleMapper">
|
|
|
|
|
|
|
|
<!--<insert id="insert" parameterType="UserDO" useGeneratedKeys="true" keyProperty="id">-->
|
|
|
|
<!--INSERT INTO users (-->
|
|
|
|
<!--id, mobile, create_time-->
|
|
|
|
<!--) VALUES (-->
|
|
|
|
<!--#{id}, #{mobile}, #{createTime}-->
|
|
|
|
<!--)-->
|
|
|
|
<!--</insert>-->
|
|
|
|
|
|
|
|
<select id="selectByAdminId" parameterType="Integer" resultType="AdminRoleDO">
|
|
|
|
SELECT
|
|
|
|
ar.id, ar.admin_id, ar.role_id
|
|
|
|
FROM admin a, admin_role ar
|
|
|
|
WHERE a.id = #{adminId}
|
|
|
|
AND a.id = ar.admin_id
|
2019-03-12 20:07:40 +08:00
|
|
|
AND ar.deleted = 0
|
2019-02-27 00:00:37 +08:00
|
|
|
</select>
|
|
|
|
|
2019-03-02 17:19:37 +08:00
|
|
|
<update id="updateToDeletedByAdminId" parameterType="Integer">
|
|
|
|
UPDATE admin_role
|
|
|
|
SET deleted = 1
|
|
|
|
WHERE admin_id = #{adminId}
|
|
|
|
AND deleted = 0
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<update id="updateToDeletedByRoleId" parameterType="Integer">
|
|
|
|
UPDATE admin_role
|
|
|
|
SET deleted = 1
|
|
|
|
WHERE role_id = #{roleId}
|
|
|
|
AND deleted = 0
|
|
|
|
</update>
|
|
|
|
|
2019-03-02 18:17:09 +08:00
|
|
|
<insert id="insertList">
|
|
|
|
INSERT INTO admin_role (
|
|
|
|
admin_id, role_id, create_time, deleted
|
|
|
|
) VALUES
|
|
|
|
<foreach collection="adminRoleDOs" item="adminRole" separator=",">
|
|
|
|
(#{adminRole.adminId}, #{adminRole.roleId}, #{adminRole.createTime}, #{adminRole.deleted})
|
|
|
|
</foreach>
|
|
|
|
</insert>
|
|
|
|
|
2019-02-27 00:00:37 +08:00
|
|
|
</mapper>
|