Merge remote-tracking branch 'origin/dev.saas' into dev
commit
de23d2e383
|
@ -0,0 +1,56 @@
|
||||||
|
package com.muyu.common.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/25 22:38
|
||||||
|
* @Description 企业表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "sys_ent")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class SysEnt extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人
|
||||||
|
*/
|
||||||
|
private String leader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库名称
|
||||||
|
*/
|
||||||
|
private Long databaseName;
|
||||||
|
}
|
|
@ -11,7 +11,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
* @author muyu
|
* @author muyu
|
||||||
*/
|
*/
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
//@EnableCustomSwagger2
|
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class CloudSystemApplication {
|
public class CloudSystemApplication {
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.muyu.system.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.constant.Constants;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.system.domain.SysEnt;
|
||||||
|
import com.muyu.system.domain.req.EntListReq;
|
||||||
|
import com.muyu.system.domain.resp.EntResp;
|
||||||
|
import com.muyu.system.service.SysEntService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/26 0:21
|
||||||
|
* @Description 企业管理控制层
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping(value = "/ent")
|
||||||
|
@Tag(name = "SysEntController", description = "企业管理")
|
||||||
|
public class SysEntController extends BaseController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业管理业务层
|
||||||
|
*/
|
||||||
|
private final SysEntService sysEntService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取企业信息
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
@Operation(summary = "获取企业信息", description = "现有的基础企业信息")
|
||||||
|
public Result<List<EntResp>> get() {
|
||||||
|
return Result.success(sysEntService.selectList(new EntListReq()), Constants.SUCCESS_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业信息列表
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/selectList")
|
||||||
|
@Operation(summary = "查询企业信息列表", description = "分页展示企业信息")
|
||||||
|
public Result<TableDataInfo<EntResp>> selectList(@RequestBody EntListReq entListReq) {
|
||||||
|
startPage();
|
||||||
|
List<EntResp> entRespList = sysEntService.selectList(entListReq);
|
||||||
|
return getDataTable(entRespList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.muyu.system.domain.req;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/26 0:49
|
||||||
|
* @Description 企业信息列表请求对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EntListReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业名称
|
||||||
|
*/
|
||||||
|
private String entName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人
|
||||||
|
*/
|
||||||
|
private String leader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库名称
|
||||||
|
*/
|
||||||
|
private String databaseName;
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.muyu.system.domain.resp;
|
||||||
|
|
||||||
|
import com.muyu.common.system.domain.SysEnt;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/26 0:42
|
||||||
|
* @Description 企业管理响应对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EntResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业ID
|
||||||
|
*/
|
||||||
|
@Schema(title = "企业ID", type = "Long", defaultValue = "1", description = "企业ID")
|
||||||
|
private Long entId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业名称
|
||||||
|
*/
|
||||||
|
@Schema(title = "企业名称", type = "String", defaultValue = "长安汽车", description = "企业名称")
|
||||||
|
private String entName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人
|
||||||
|
*/
|
||||||
|
@Schema(title = "负责人", type = "String", defaultValue = "张三", description = "负责人")
|
||||||
|
private String leader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
@Schema(title = "手机号码", type = "String", defaultValue = "18321974313", description = "手机号码")
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
@Schema(title = "邮箱", type = "String", defaultValue = "12123@qq.com", description = "邮箱账号")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库名称
|
||||||
|
*/
|
||||||
|
private Long databaseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业管理响应对象构建者模式
|
||||||
|
*/
|
||||||
|
public static EntResp entBuild(SysEnt sysEnt) {
|
||||||
|
return EntResp.builder()
|
||||||
|
.entId(sysEnt.getId())
|
||||||
|
.entName(sysEnt.getName())
|
||||||
|
.leader(sysEnt.getLeader())
|
||||||
|
.phoneNumber(sysEnt.getPhoneNumber())
|
||||||
|
.email(sysEnt.getEmail())
|
||||||
|
.databaseName(sysEnt.getDatabaseName())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.muyu.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.common.system.domain.SysEnt;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/26 0:10
|
||||||
|
* @Description 企业管理持久层
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysEntMapper extends BaseMapper<SysEnt> {
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.common.system.domain.SysEnt;
|
||||||
|
import com.muyu.system.domain.req.EntListReq;
|
||||||
|
import com.muyu.system.domain.resp.EntResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/26 0:14
|
||||||
|
* @Description 企业管理业务层
|
||||||
|
*/
|
||||||
|
public interface SysEntService extends IService<SysEnt> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业信息列表
|
||||||
|
* @param entListReq 企业列表请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
public List<EntResp> selectList(EntListReq entListReq);
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.muyu.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.common.system.domain.SysEnt;
|
||||||
|
import com.muyu.system.domain.req.EntListReq;
|
||||||
|
import com.muyu.system.domain.resp.EntResp;
|
||||||
|
import com.muyu.system.mapper.SysEntMapper;
|
||||||
|
import com.muyu.system.service.SysEntService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/26 0:15
|
||||||
|
* @Description 企业管理业务实现层
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SysEntServiceImpl extends ServiceImpl<SysEntMapper, SysEnt> implements SysEntService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业管理持久层
|
||||||
|
*/
|
||||||
|
private final SysEntMapper sysEntMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业信息列表
|
||||||
|
* @param entListReq 企业列表请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<EntResp> selectList(EntListReq entListReq) {
|
||||||
|
LambdaQueryWrapper<SysEnt> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.like(
|
||||||
|
StringUtils.isNotEmpty(entListReq.getEntName()),
|
||||||
|
SysEnt::getName, entListReq.getEntName()
|
||||||
|
);
|
||||||
|
queryWrapper.like(
|
||||||
|
StringUtils.isNotEmpty(entListReq.getLeader()),
|
||||||
|
SysEnt::getLeader, entListReq.getLeader()
|
||||||
|
);
|
||||||
|
queryWrapper.like(
|
||||||
|
StringUtils.isNotEmpty(entListReq.getPhoneNumber()),
|
||||||
|
SysEnt::getPhoneNumber, entListReq.getPhoneNumber()
|
||||||
|
);
|
||||||
|
queryWrapper.like(
|
||||||
|
StringUtils.isNotEmpty(entListReq.getEmail()),
|
||||||
|
SysEnt::getEmail, entListReq.getEmail()
|
||||||
|
);
|
||||||
|
queryWrapper.eq(
|
||||||
|
StringUtils.isNotEmpty(entListReq.getDatabaseName()),
|
||||||
|
SysEnt::getDatabaseName, entListReq.getDatabaseName()
|
||||||
|
|
||||||
|
);
|
||||||
|
List<SysEnt> sysEntList = this.list(queryWrapper);
|
||||||
|
|
||||||
|
return sysEntList.stream()
|
||||||
|
.map(EntResp::entBuild)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue