拓恒统一认证授权服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 line
3.1KB

  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.tuoheng.mapper.TenantMapper">
  4. <sql id="Base_Column_List">
  5. id,create_time,update_time,create_user,update_user,user_id,remark,`code`,`name`,
  6. enabled,province_code,province_name,
  7. city_code,city_name,district_code,district_name,customer,
  8. customer_phone,adress,lng,lat
  9. </sql>
  10. <insert id="insertTenant" parameterType="com.tuoheng.model.po.TenantPo" keyProperty="id" useGeneratedKeys="true">
  11. INSERT INTO t_tenant (user_id, remark, `code`, `name`, province_code, province_name, city_code, city_name,
  12. district_code, district_name, customer, customer_phone, adress, lng, lat)
  13. VALUES (#{userId}, #{remark}, #{code}, #{name}, #{provinceCode}, #{provinceName}, #{cityCode}, #{cityName},
  14. #{districtCode}, #{districtName}, #{customer}, #{customerPhone}, #{adress}, #{lng}, #{lat})
  15. </insert>
  16. <update id="updateById" parameterType="com.tuoheng.model.po.TenantPo">
  17. update t_tenant
  18. <set>
  19. <if test="name != null and name !=''">
  20. name = #{name},
  21. </if>
  22. <if test="enabled != null">
  23. enabled = #{enabled},
  24. </if>
  25. province_code=#{provinceCode},
  26. province_name=#{provinceName},
  27. city_code =#{cityCode},
  28. city_name=#{cityName},
  29. district_code =#{districtCode},
  30. district_name =#{districtName},
  31. customer =#{customer},
  32. customer_phone =#{customerPhone},
  33. adress =#{adress},
  34. lng =#{lng},
  35. lat =#{lat}
  36. </set>
  37. where id = #{id}
  38. </update>
  39. <select id="getByCode" resultType="com.tuoheng.model.dto.TTenant">
  40. select *
  41. from tuoheng_oidc.t_tenant
  42. where code = #{code}
  43. and enabled = 1
  44. </select>
  45. <select id="findList" resultType="com.tuoheng.model.vo.TenantVo">
  46. SELECT t.id, t.user_id userId, t.remark, t.code tenantCode,
  47. t.name tenantName,t.customer,t.customer_phone
  48. ,t.province_code,t.province_name,t.city_code,t.city_name,t.district_code,t.district_name,u.username
  49. username,t.update_time updateTime,t.create_time createTime,u.is_able status
  50. FROM t_tenant t,users u
  51. WHERE t.enabled = 1 and t.user_id =u.id
  52. <if test="query.tenantName != null and query.tenantName != ''">
  53. and t.name LIKE concat('%',#{query.tenantName},'%')
  54. </if>
  55. <if test="query.username != null and query.username != ''">
  56. and u.username LIKE concat('%',#{query.username},'%')
  57. </if>
  58. <if test="query.status != null">
  59. and u.is_able =#{query.status}
  60. </if>
  61. ORDER BY t.create_time desc
  62. </select>
  63. <select id="selectById" resultType="com.tuoheng.model.po.TenantPo">
  64. SELECT
  65. <include refid="Base_Column_List"/>
  66. FROM t_tenant
  67. WHERE id = #{id}
  68. and enabled = 1
  69. </select>
  70. </mapper>