SysUserTenantMapper.xml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.ym.mec.biz.dal.dao.SysUserTenantDao">
  4. <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.SysUserTenant">
  5. <id column="id_" jdbcType="INTEGER" property="id"/>
  6. <result column="user_id_" jdbcType="INTEGER" property="userId"/>
  7. <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
  8. <result column="created_by_" jdbcType="INTEGER" property="createdBy"/>
  9. <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime"/>
  10. </resultMap>
  11. <sql id="Base_Column_List">
  12. id_
  13. , user_id_, tenant_id_, created_by_, created_time_
  14. </sql>
  15. <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
  16. parameterType="com.ym.mec.biz.dal.entity.SysUserTenant">
  17. insert into sys_user_tenant(user_id_, tenant_id_, created_by_, created_time_)
  18. values
  19. <foreach collection="entities" item="entity" separator=",">
  20. (#{entity.userId}, #{entity.tenantId}, #{entity.createdBy}, #{entity.createdTime})
  21. </foreach>
  22. </insert>
  23. <select id="queryUserTenant" resultType="com.ym.mec.biz.dal.vo.SysUserTenantVo">
  24. select
  25. a.id_ as id,
  26. a.user_id_ as userId,
  27. b.id_ as tenantId,
  28. b.name_ as tenantName
  29. from sys_user_tenant as a
  30. left join tenant_info as b on a.tenant_id_ = b.id_
  31. where a.user_id_ = #{userId}
  32. </select>
  33. <select id="personOwnerList"
  34. resultType="com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetExtendWrapper$MusicSheetExtend">
  35. select su.id_ userId,su.real_name_ username
  36. ,'TEACHER' clientType,su.phone_ phone from teacher t
  37. left join sys_user su ON su.id_ = t.id_
  38. where su.user_type_ LIKE '%TEACHER%' AND su.del_flag_ = 0 AND su.lock_flag_ = 0
  39. <if test="param.name != null and param.name != ''">
  40. AND (su.phone_ LIKE CONCAT('%',#{param.name},'%') OR su.username_ LIKE CONCAT('%',#{param.name},'%'))
  41. </if>
  42. <if test="param.userIdList != null and param.userIdList.size > 0">
  43. AND su.id_ IN
  44. <foreach collection="param.userIdList" item="item" open="(" close=")" separator=",">
  45. #{item}
  46. </foreach>
  47. </if>
  48. </select>
  49. <select id="orgOwnerList"
  50. resultType="com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetExtendWrapper$MusicSheetExtend">
  51. select id_ organizationRoleId,name_ organizationRole,'ORG' clientType,phone_ phone from tenant_info where state_ = 1
  52. <if test="param.name != null and param.name != ''">
  53. AND (phone_ LIKE CONCAT('%',#{param.name},'%') OR name_ LIKE CONCAT('%',#{param.name},'%'))
  54. </if>
  55. <if test="param.userIdList != null and param.userIdList.size > 0">
  56. AND id_ IN
  57. <foreach collection="param.userIdList" item="item" open="(" close=")" separator=",">
  58. #{item}
  59. </foreach>
  60. </if>
  61. </select>
  62. </mapper>