Browse Source

新增租户添加省市区相关字段并新增城市表

tags/v2.4.0
xiaoying 1 year ago
parent
commit
f64b2c6426
20 changed files with 160 additions and 18 deletions
  1. +2
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/CityMapper.java
  2. +3
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/TenantMapper.java
  3. +25
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/dto/TTenant.java
  4. +27
    -1
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/CreateClientUserDto.java
  5. +24
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/po/TenantPo.java
  6. +10
    -3
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java
  7. +6
    -6
      tuoheng_oidc_admin/src/main/resources/mapper/CityMapper.xml
  8. +20
    -2
      tuoheng_oidc_admin/src/main/resources/mapper/TenantMapper.xml
  9. +5
    -1
      tuoheng_oidc_admin/target/classes/WEB-INF/classes/application-dev.yml
  10. +5
    -1
      tuoheng_oidc_admin/target/classes/application-dev.yml
  11. +4
    -0
      tuoheng_oidc_admin/target/classes/application-test.yml
  12. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/mapper/ClientUserMapper.class
  13. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/mapper/TenantMapper.class
  14. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/model/dto/OidcTenantDto.class
  15. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/model/dto/TTenant.class
  16. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/model/param/CreateClientUserDto.class
  17. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/model/po/TenantPo.class
  18. BIN
      tuoheng_oidc_admin/target/classes/com/tuoheng/service/impl/ClientUserServiceImpl.class
  19. +7
    -0
      tuoheng_oidc_admin/target/classes/mapper/ClientUserMapper.xml
  20. +22
    -4
      tuoheng_oidc_admin/target/classes/mapper/TenantMapper.xml

+ 2
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/CityMapper.java View File

@@ -2,6 +2,7 @@ package com.tuoheng.mapper;

import com.tuoheng.model.dto.City;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* @author 小影
@@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @createDate 2023-02-03 09:57:16
* @Entity com.tuoheng.model.dto.City
*/
@Mapper
public interface CityMapper extends BaseMapper<City> {

}

+ 3
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/TenantMapper.java View File

@@ -29,4 +29,7 @@ public interface TenantMapper {
void updateById(TenantPo tenantPo);

TenantPo selectById(Long id);

@Select("select * from tuoheng_oidc.t_tenant where enabled =1")
List<TTenant> selectList();
}

+ 25
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/dto/TTenant.java View File

@@ -62,6 +62,31 @@ public class TTenant implements Serializable {
*/
private Integer enabled;

/**
* 省级编码
*/
private String provinceCode;
/**
* 省份名称
*/
private String provinceName;
/**
*市区编号
*/
private String cityCode;
/**
* 市区名称
*/
private String cityName;
/**
* 区县编号
*/
private String districtCode;
/**
* 区县名称
*/
private String districtName;

@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

+ 27
- 1
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/CreateClientUserDto.java View File

@@ -34,7 +34,7 @@ public class CreateClientUserDto {
@NotNull(message = "clientRoleDtoList can not be null!")
private List<ClientRoleDto> clientRoleDtoList;
/**
* 租户cod
* 租户code
*/
private String code;
/**
@@ -42,4 +42,30 @@ public class CreateClientUserDto {
*/
private String name;


/**
* 省级编码
*/
private String provinceCode;
/**
* 省份名称
*/
private String provinceName;
/**
*市区编号
*/
private String cityCode;
/**
* 市区名称
*/
private String cityName;
/**
* 区县编号
*/
private String districtCode;
/**
* 区县名称
*/
private String districtName;

}

+ 24
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/po/TenantPo.java View File

@@ -24,4 +24,28 @@ public class TenantPo extends BasePo {

private String name;

/**
* 省级编码
*/
private String provinceCode;
/**
* 省份名称
*/
private String provinceName;
/**
*市区编号
*/
private String cityCode;
/**
* 市区名称
*/
private String cityName;
/**
* 区县编号
*/
private String districtCode;
/**
* 区县名称
*/
private String districtName;
}

+ 10
- 3
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientUserServiceImpl.java View File

@@ -109,6 +109,13 @@ public class ClientUserServiceImpl implements ClientUserSevice {
//添加租户code
tenantPo.setCode(createClientUserDto.getCode());
tenantPo.setName(createClientUserDto.getName());
tenantPo.setProvinceCode(createClientUserDto.getProvinceCode());
tenantPo.setProvinceName(createClientUserDto.getProvinceName());
tenantPo.setDistrictCode(createClientUserDto.getDistrictCode());
tenantPo.setDistrictName(createClientUserDto.getDistrictName());
tenantPo.setCityCode(createClientUserDto.getCityCode());
tenantPo.setCityName(createClientUserDto.getCityName());
log.debug("信息:" + tenantPo.toString());
tenantMapper.insertTenant(tenantPo);
}
}
@@ -358,14 +365,14 @@ public class ClientUserServiceImpl implements ClientUserSevice {
return jsonResult;
}
//TODO ->会导致循环终止(后期改进)
requestAirport(dto, loginUser, CommonConstant.TWO);
requestAirport(dto, loginUser, CommonConstant.TWO);
}
} else {
JsonResult jsonResult = editResult(dto, dto.getClientId(), loginUser);
if (!"操作成功".equals(jsonResult.getMsg())) {
return jsonResult;
}
requestAirport(dto, loginUser, CommonConstant.TWO);
requestAirport(dto, loginUser, CommonConstant.TWO);
}
TTenant tTenant = tenantMapper.getByCode(dto.getCode());
dto.setId(tTenant.getId());
@@ -545,7 +552,7 @@ public class ClientUserServiceImpl implements ClientUserSevice {
resultRequestHeader.add("Authorization", "Bearer " + loginUser.getThToken());
HttpEntity httpEntity = new HttpEntity(request, resultRequestHeader);
//设置地址(机场平台->配置文件)
String url="";
String url = "";
switch (type) {
case 1:
url = CommonConfig.airportURL + AirportConstant.CREATE_TENANT;

+ 6
- 6
tuoheng_oidc_admin/src/main/resources/mapper/CityMapper.xml View File

@@ -5,19 +5,19 @@
<mapper namespace="com.tuoheng.mapper.CityMapper">

<resultMap id="BaseResultMap" type="com.tuoheng.model.dto.City">
<id property="id" column="id" jdbcType="OTHER"/>
<result property="pid" column="pid" jdbcType="OTHER"/>
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="pid" column="pid" jdbcType="INTEGER"/>
<result property="level" column="level" jdbcType="TINYINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="citycode" column="citycode" jdbcType="VARCHAR"/>
<result property="pAdcode" column="p_adcode" jdbcType="VARCHAR"/>
<result property="adcode" column="adcode" jdbcType="VARCHAR"/>
<result property="lng" column="lng" jdbcType="OTHER"/>
<result property="lat" column="lat" jdbcType="OTHER"/>
<result property="lng" column="lng" jdbcType="INTEGER"/>
<result property="lat" column="lat" jdbcType="INTEGER"/>
<result property="sort" column="sort" jdbcType="TINYINT"/>
<result property="createUser" column="create_user" jdbcType="OTHER"/>
<result property="createUser" column="create_user" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUser" column="update_user" jdbcType="OTHER"/>
<result property="updateUser" column="update_user" jdbcType="INTEGER"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="mark" column="mark" jdbcType="TINYINT"/>
</resultMap>

+ 20
- 2
tuoheng_oidc_admin/src/main/resources/mapper/TenantMapper.xml View File

@@ -3,8 +3,8 @@
<mapper namespace="com.tuoheng.mapper.TenantMapper">

<insert id="insertTenant" parameterType="com.tuoheng.model.po.TenantPo" keyProperty="id" useGeneratedKeys="true">
INSERT INTO t_tenant (user_id, remark, `code`, `name`)
VALUES (#{userId}, #{remark}, #{code}, #{name})
INSERT INTO t_tenant (user_id, remark, `code`, `name`,province_code,province_name,city_code,city_name,district_code,district_name)
VALUES (#{userId}, #{remark}, #{code}, #{name},#{provinceCode},#{provinceName},#{cityCode},#{cityName},#{districtCode},#{districtName})
</insert>
<update id="updateById" parameterType="com.tuoheng.model.po.TenantPo">
update t_tenant
@@ -15,6 +15,24 @@
<if test="enabled != null">
enabled = #{enabled},
</if>
<if test="provinceCode != null and provinceCode !=''">
province_code = #{provinceCode},
</if>
<if test="provinceName != null and provinceName !=''">
province_name = #{provinceName},
</if>
<if test="cityCode != null and cityCode !=''">
city_code = #{cityCode},
</if>
<if test="cityName != null and cityName !=''">
city_name = #{cityName},
</if>
<if test="districtCode != null and districtCode !=''">
district_code = #{districtCode},
</if>
<if test="districtName != null and districtName !=''">
district_name = #{districtName},
</if>
</set>
where id = #{id}
</update>

+ 5
- 1
tuoheng_oidc_admin/target/classes/WEB-INF/classes/application-dev.yml View File

@@ -65,4 +65,8 @@ spring:
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接
min-idle: 1 # 连接池中的最小空闲连接
min-idle: 1 # 连接池中的最小空闲连接
# 自定义配置
tuoheng:
#airport配置地址
airport-url: https://airport-test.t-aaron.com

+ 5
- 1
tuoheng_oidc_admin/target/classes/application-dev.yml View File

@@ -65,4 +65,8 @@ spring:
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接
min-idle: 1 # 连接池中的最小空闲连接
min-idle: 1 # 连接池中的最小空闲连接
# 自定义配置
tuoheng:
#airport配置地址
airport-url: https://airport-test.t-aaron.com

+ 4
- 0
tuoheng_oidc_admin/target/classes/application-test.yml View File

@@ -65,3 +65,7 @@ spring:
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接
min-idle: 1 # 连接池中的最小空闲连接
# 自定义配置
tuoheng:
#airport配置地址
airport-url: https://airport-test.t-aaron.com

BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/mapper/ClientUserMapper.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/mapper/TenantMapper.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/model/dto/OidcTenantDto.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/model/dto/TTenant.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/model/param/CreateClientUserDto.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/model/po/TenantPo.class View File


BIN
tuoheng_oidc_admin/target/classes/com/tuoheng/service/impl/ClientUserServiceImpl.class View File


+ 7
- 0
tuoheng_oidc_admin/target/classes/mapper/ClientUserMapper.xml View File

@@ -29,6 +29,13 @@
WHERE id = #{userId}
and enabled = 1
</select>
<select id="selectByTenantId" resultType="com.tuoheng.model.po.UserPo">
SELECT *
FROM users
WHERE tenant_id = #{tenantId}
# 用户没有被删除
and enabled = 1
</select>

<update id="updatePass" parameterType="com.tuoheng.model.po.UserPo">
update users

+ 22
- 4
tuoheng_oidc_admin/target/classes/mapper/TenantMapper.xml View File

@@ -3,18 +3,36 @@
<mapper namespace="com.tuoheng.mapper.TenantMapper">

<insert id="insertTenant" parameterType="com.tuoheng.model.po.TenantPo" keyProperty="id" useGeneratedKeys="true">
INSERT INTO t_tenant (user_id, remark, `code`, `name`)
VALUES (#{userId}, #{remark}, #{code}, #{name})
INSERT INTO t_tenant (user_id, remark, `code`, `name`,province_code,province_name,city_code,city_name,district_code,district_name)
VALUES (#{userId}, #{remark}, #{code}, #{name},#{provinceCode},#{provinceName},#{cityCode},#{cityName},#{districtCode},#{districtName})
</insert>
<update id="updateById" parameterType="com.tuoheng.model.po.TenantPo">
update t_tenant
<set>
<if test="name !=null and name !=''">
<if test="name != null and name !=''">
name = #{name},
</if>
<if test="enabled !=null">
<if test="enabled != null">
enabled = #{enabled},
</if>
<if test="provinceCode != null and provinceCode !=''">
province_code = #{provinceCode},
</if>
<if test="provinceName != null and provinceName !=''">
province_name = #{provinceName},
</if>
<if test="cityCode != null and cityCode !=''">
city_code = #{cityCode},
</if>
<if test="cityName != null and cityName !=''">
city_name = #{cityName},
</if>
<if test="districtCode != null and districtCode !=''">
district_code = #{districtCode},
</if>
<if test="districtName != null and districtName !=''">
district_name = #{districtName},
</if>
</set>
where id = #{id}
</update>

Loading…
Cancel
Save