jiangping
2024-07-31 bed3eee53f72f47f49b493772a4525e6c6b3e7be
server/dmvisit_service/src/main/resources/mappers/SystemRoleMapper.xml
对比新文件
@@ -0,0 +1,49 @@
<?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.doumee.dao.system.SystemRoleMapper">
  <!-- 鏌ヨ瑙掕壊鍒楄〃 -->
  <resultMap id="SystemRoleListVO" type="com.doumee.dao.system.vo.SystemRoleListVO" autoMapping="true">
    <id column="ID" property="id"/>
    <association property="createUserInfo" javaType="com.doumee.dao.system.model.SystemUser">
      <id column="CREATE_USER_ID" property="id"/>
      <result column="CREATE_USER_NAME" property="username"/>
    </association>
    <association property="updateUserInfo" javaType="com.doumee.dao.system.model.SystemUser">
      <id column="UPDATE_USER_ID" property="id"/>
      <result column="UPDATE_USER_NAME" property="username"/>
    </association>
  </resultMap>
  <select id="selectManageList" parameterType="com.doumee.dao.system.dto.QuerySystemUserDTO" resultMap="SystemRoleListVO">
    SELECT
      role.ID, role.`CODE`, role.`NAME`, role.`REMARK`, role.`FIXED`, role.`CREATE_TIME`, role.`UPDATE_TIME`,
      create_user.ID CREATE_USER_ID, create_user.`USERNAME` CREATE_USER_NAME,
      update_user.ID UPDETE_USER_ID, update_user.`USERNAME` UPDATE_USER_NAME
    FROM SYSTEM_ROLE role
    LEFT JOIN `SYSTEM_USER` create_user ON create_user.ID = role.CREATE_USER
    LEFT JOIN `SYSTEM_USER` update_user ON update_user.ID = role.UPDATE_USER
    <where>
      role.DELETED = 0
      <if test="dto.code != null and dto.code != ''">
        AND role.`CODE` LIKE CONCAT('%', #{dto.code}, '%')
      </if>
      <if test="dto.name != null and dto.name != ''">
        AND role.`NAME` LIKE CONCAT('%', #{dto.name}, '%')
      </if>
    </where>
    ${orderByClause}
  </select>
  <!-- 鏌ヨ鐢ㄦ埛瑙掕壊鍒楄〃 -->
  <select id="selectByUserId" parameterType="java.lang.Integer" resultType="com.doumee.dao.system.model.SystemRole">
    SELECT
    role.ID, role.`CODE`, role.`NAME`, role.`REMARK`, role.`CREATE_TIME`, role.`UPDATE_TIME`
    FROM SYSTEM_ROLE role
    INNER JOIN SYSTEM_USER_ROLE user_role ON user_role.ROLE_ID = role.ID AND user_role.DELETED = 0
    <where>
      role.DELETED = 0
      AND user_role.USER_ID = #{userId}
    </where>
  </select>
</mapper>