xuhy
2025-01-22 e78da8ca397fbfca8d57ab518e1778dd57e0dd90
租户类型属性
8个文件已修改
2个文件已添加
87 ■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTenantController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/constant/DictConstants.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TTenantMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TTenant.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/TTenantService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTenantServiceImpl.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/vo/TenantVO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TTenantMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTenantController.java
@@ -11,9 +11,11 @@
import com.ruoyi.system.model.TTenant;
import com.ruoyi.system.query.TTenantQuery;
import com.ruoyi.system.service.TTenantService;
import com.ruoyi.system.vo.TenantVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -41,15 +43,17 @@
    /**
     * 获取租户管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:tenant:list')")
    @ApiOperation(value = "获取租户分页列表")
    @PostMapping(value = "/pageList")
    public R<PageInfo<TTenant>> pageList(@RequestBody TTenantQuery query) {
    public R<PageInfo<TenantVO>> pageList(@RequestBody TTenantQuery query) {
        return R.ok(tenantService.pageList(query));
    }
    /**
     * 添加租户管理
     */
    @PreAuthorize("@ss.hasPermi('system:tenant:add')")
    @Log(title = "租户信息-新增租户", businessType = BusinessType.INSERT)
    @ApiOperation(value = "添加租户")
    @PostMapping(value = "/add")
@@ -62,6 +66,7 @@
    /**
     * 修改租户
     */
    @PreAuthorize("@ss.hasPermi('system:tenant:update')")
    @Log(title = "租户信息-修改租户", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "修改租户")
    @PostMapping(value = "/update")
@@ -76,6 +81,7 @@
    /**
     * 查看租户详情
     */
    @PreAuthorize("@ss.hasPermi('system:tenant:detail')")
    @ApiOperation(value = "查看租户详情")
    @GetMapping(value = "/getDetailById")
    public R<TTenant> getDetailById(@RequestParam String id) {
@@ -85,6 +91,7 @@
    /**
     * 删除租户
     */
    @PreAuthorize("@ss.hasPermi('system:tenant:delete')")
    @Log(title = "租户信息-删除租户", businessType = BusinessType.DELETE)
    @ApiOperation(value = "删除租户")
    @DeleteMapping(value = "/deleteById")
@@ -95,6 +102,7 @@
    /**
     * 批量删除租户
     */
    @PreAuthorize("@ss.hasPermi('system:tenant:delete')")
    @Log(title = "租户信息-删除租户", businessType = BusinessType.DELETE)
    @ApiOperation(value = "批量删除租户")
    @DeleteMapping(value = "/deleteByIds")
ruoyi-common/src/main/java/com/ruoyi/common/constant/DictConstants.java
New file
@@ -0,0 +1,18 @@
package com.ruoyi.common.constant;
/**
 * 缓存的key 常量
 *
 * @author ruoyi
 */
public class DictConstants
{
    /**
     * 租户属性
     */
    public static final String DICT_TYPE_TENANT_ATTRIBUTE = "t_tenant_attribute";
    /**
     * 租户类型
     */
    public static final String DICT_TYPE_TENANT_TYPE = "t_tenant_type";
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java
@@ -1,6 +1,8 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysDictData;
@@ -9,6 +11,7 @@
 * 
 * @author ruoyi
 */
@Mapper
public interface SysDictDataMapper
{
    /**
@@ -92,4 +95,6 @@
     * @return 结果
     */
    public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
    public String selectDictDataByTypeAndValue(@Param("dictType")String dictType, @Param("dictValue")Integer dictValue);
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TTenantMapper.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.system.model.TTenant;
import com.ruoyi.system.query.TTenantQuery;
import com.ruoyi.system.vo.TenantVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -24,7 +25,7 @@
     * @param pageInfo
     * @return
     */
    List<TTenant> pageList(@Param("query") TTenantQuery query, @Param("pageInfo")PageInfo<TTenant> pageInfo);
    List<TenantVO> pageList(@Param("query") TTenantQuery query, @Param("pageInfo")PageInfo<TenantVO> pageInfo);
}
ruoyi-system/src/main/java/com/ruoyi/system/model/TTenant.java
@@ -55,7 +55,7 @@
    @ApiModelProperty(value = "租户类型")
    @TableField("tenant_type")
    private Integer tenantType;
    private String tenantType;
    @ApiModelProperty(value = "联系电话")
    @NotBlank(message = "联系电话不能为空")
ruoyi-system/src/main/java/com/ruoyi/system/service/TTenantService.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.system.model.TTenant;
import com.ruoyi.system.query.TTenantQuery;
import com.ruoyi.system.vo.TenantVO;
/**
 * <p>
@@ -20,5 +21,5 @@
     * @param query
     * @return
     */
    PageInfo<TTenant> pageList(TTenantQuery query);
    PageInfo<TenantVO> pageList(TTenantQuery query);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTenantServiceImpl.java
@@ -1,12 +1,15 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.constant.DictConstants;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.system.mapper.TTenantMapper;
import com.ruoyi.system.model.TTenant;
import com.ruoyi.system.query.TTenantQuery;
import com.ruoyi.system.service.TTenantService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.vo.SysUserVO;
import com.ruoyi.system.vo.TenantVO;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -23,9 +26,13 @@
public class TTenantServiceImpl extends ServiceImpl<TTenantMapper, TTenant> implements TTenantService {
    @Override
    public PageInfo<TTenant> pageList(TTenantQuery query) {
        PageInfo<TTenant> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<TTenant> list = this.baseMapper.pageList(query,pageInfo);
    public PageInfo<TenantVO> pageList(TTenantQuery query) {
        PageInfo<TenantVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<TenantVO> list = this.baseMapper.pageList(query,pageInfo);
        for (TenantVO tenantVO : list) {
            tenantVO.setTenantAttributesName(DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_ATTRIBUTE,tenantVO.getTenantAttributes()));
            tenantVO.setTenantTypeName(DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_TYPE,tenantVO.getTenantType()));
        }
        pageInfo.setRecords(list);
        return pageInfo;
    }
ruoyi-system/src/main/java/com/ruoyi/system/vo/TenantVO.java
New file
@@ -0,0 +1,21 @@
package com.ruoyi.system.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.system.model.TTenant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@ApiModel(value = "租户列表VO")
public class TenantVO extends TTenant {
    @ApiModelProperty(value = "租户属性")
    private String tenantAttributesName;
    @ApiModelProperty(value = "租户类型")
    private String tenantTypeName;
}
ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml
@@ -59,8 +59,11 @@
    <select id="countDictDataByType" resultType="Integer">
        select count(1) from sys_dict_data where dict_type=#{dictType}  
    </select>
    <delete id="deleteDictDataById" parameterType="Long">
    <select id="selectDictDataByTypeAndValue" resultType="java.lang.String">
        select dict_label from sys_dict_data where dict_type=#{dictType} and dict_value=#{dictValue}
    </select>
    <delete id="deleteDictDataById" parameterType="Long">
         delete from sys_dict_data where dict_code = #{dictCode}
     </delete>
     
ruoyi-system/src/main/resources/mapper/system/TTenantMapper.xml
@@ -28,8 +28,9 @@
        id, resident_name, checkIn_time, tenant_attributes, tenant_type, phone, id_card, email,
            bank_number, mail_address, create_time, update_time, create_by, update_by, disabled,account,password
    </sql>
    <select id="pageList" resultType="com.ruoyi.system.model.TTenant">
        SELECT <include refid="Base_Column_List"/>
    <select id="pageList" resultType="com.ruoyi.system.vo.TenantVO">
        SELECT id, resident_name, checkIn_time, tenant_attributes, tenant_type, phone, id_card, email,
        bank_number, mail_address, create_time, disabled,account,
        FROM t_tenant
        <where>
            <if test="query.residentName != null and query.residentName != ''">