| | |
| | | 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.*; |
| | | |
| | |
| | | /** |
| | | * 获取租户管理列表 |
| | | */ |
| | | @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") |
| | |
| | | /** |
| | | * 修改租户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:tenant:update')") |
| | | @Log(title = "租户信息-修改租户", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改租户") |
| | | @PostMapping(value = "/update") |
| | |
| | | /** |
| | | * 查看租户详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:tenant:detail')") |
| | | @ApiOperation(value = "查看租户详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TTenant> getDetailById(@RequestParam String id) { |
| | |
| | | /** |
| | | * 删除租户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:tenant:delete')") |
| | | @Log(title = "租户信息-删除租户", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除租户") |
| | | @DeleteMapping(value = "/deleteById") |
| | |
| | | /** |
| | | * 批量删除租户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:tenant:delete')") |
| | | @Log(title = "租户信息-删除租户", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除租户") |
| | | @DeleteMapping(value = "/deleteByIds") |
New file |
| | |
| | | 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"; |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Mapper |
| | | public interface SysDictDataMapper |
| | | { |
| | | /** |
| | |
| | | * @return 结果 |
| | | */ |
| | | public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType); |
| | | |
| | | public String selectDictDataByTypeAndValue(@Param("dictType")String dictType, @Param("dictValue")Integer dictValue); |
| | | } |
| | |
| | | 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; |
| | |
| | | * @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); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "租户类型") |
| | | @TableField("tenant_type") |
| | | private Integer tenantType; |
| | | private String tenantType; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | @NotBlank(message = "联系电话不能为空") |
| | |
| | | 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> |
| | |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TTenant> pageList(TTenantQuery query); |
| | | PageInfo<TenantVO> pageList(TTenantQuery query); |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | <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> |
| | | |
| | |
| | | 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 != ''"> |