diff --git a/cloud-modules/cloud-modules-firmmanage/pom.xml b/cloud-modules/cloud-modules-firmmanage/pom.xml index 325ed67..deb9e35 100644 --- a/cloud-modules/cloud-modules-firmmanage/pom.xml +++ b/cloud-modules/cloud-modules-firmmanage/pom.xml @@ -61,12 +61,6 @@ cloud-common-datascope - - - com.muyu - cloud-common-log - - com.muyu diff --git a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/FirmManageApplication.java b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/FirmManageApplication.java new file mode 100644 index 0000000..10d27ae --- /dev/null +++ b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/FirmManageApplication.java @@ -0,0 +1,18 @@ +package com.muyu.firmmanage; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @Author:weiran + * @Package:com.muyu.firmmanage + * @Project:cloud-server-8 + * @name:FirmManageApplication + * @Date:2024/9/27 21:19 + */ +@SpringBootApplication +public class FirmManageApplication { + public static void main(String[] args) { + SpringApplication.run(FirmManageApplication.class, args); + } +} diff --git a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/controller/FirmManageController.java b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/controller/FirmManageController.java index 0392416..348aa34 100644 --- a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/controller/FirmManageController.java +++ b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/controller/FirmManageController.java @@ -1,5 +1,15 @@ package com.muyu.firmmanage.controller; +import com.muyu.common.core.domain.Result; +import com.muyu.firmmanage.domain.req.FirmListReq; +import com.muyu.firmmanage.domain.resp.firmlist.FirmTotalListResp; +import com.muyu.firmmanage.service.FirmManageService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -12,5 +22,25 @@ import org.springframework.web.bind.annotation.RestController; */ @RestController @RequestMapping("/firmmanage") +@Tag(name = "公司相关事务",description = "公司相关事务操作") public class FirmManageController { + + @Autowired + private FirmManageService firmManageService; + + + /** + * 公司列表信息展示 + * @param firmListReq + * @return + */ + @PostMapping("/firmmessageList") + @Operation(summary = "公司信息列表展示",description = "展示公司信息的列表") + public Result firmmessageList(@Validated @RequestBody FirmListReq firmListReq){ + FirmTotalListResp firmTotalListResp = firmManageService.firmmessageList(firmListReq); + return Result.success(firmTotalListResp); + } + + + } diff --git a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/Firm.java b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/Firm.java index 3421bd3..4f9d463 100644 --- a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/Firm.java +++ b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/Firm.java @@ -1,10 +1,17 @@ package com.muyu.firmmanage.domain; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.muyu.common.core.web.domain.BaseEntity; +import com.muyu.common.security.utils.SecurityUtils; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; +import java.util.Date; + /** * @Author:weiran * @Package:com.muyu.firmmanage.domain @@ -12,9 +19,97 @@ import lombok.experimental.SuperBuilder; * @name:Firm * @Date:2024/9/27 12:29 */ +@EqualsAndHashCode(callSuper = true) @Data @AllArgsConstructor @NoArgsConstructor @SuperBuilder -public class Firm { +public class Firm extends BaseEntity { + /** + * 用户ID + */ + private Long userId; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 用户账号 + */ + private String userName; + + /** + * 用户昵称 + */ + private String nickName; + + /** + * 用户类型(00系统用户) + */ + private String userType; + + /** + * 用户邮箱 + */ + private String email; + + /** + * 手机号码 + */ + private String phonenumber; + + /** + * 用户性别(0男 1女 2未知) + */ + private Integer sex; + + /** + * 头像地址 + */ + private String avatar; + + /** + * 密码 + */ + private String password; + + /** + * 帐号状态(0正常 1停用) + */ + private Integer status; + + /** + * 删除标志(0代表存在 2代表删除) + */ + private String delFlag; + + /** + * 最后登录IP + */ + private String loginIp; + + /** + * 最后登录时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date loginDate; + + /** + * 数据库名称 + */ + private String databaseName; + + /** + * 企业ID + */ + private Long firmId; + /** + * 企业名称 + */ + @TableField(exist = false) + private String firmName; + + } diff --git a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/req/FirmListReq.java b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/req/FirmListReq.java new file mode 100644 index 0000000..08a3371 --- /dev/null +++ b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/req/FirmListReq.java @@ -0,0 +1,36 @@ +package com.muyu.firmmanage.domain.req; + +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author:weiran + * @Package:com.muyu.firmmanage.domain.req + * @Project:cloud-server-8 + * @name:FirmListReq + * @Date:2024/9/27 19:19 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Tag(name = "公司信息响应对象",description = "公司信息响应对象") +public class FirmListReq { + + /** + * 公司名称 + */ + private String firmName; + /** + * 页码,从1开始 + */ + private Integer pageNum=1; + /** + * 每页大小 + */ + private Integer pageSize=10; + +} diff --git a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/resp/firmlist/FirmListResp.java b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/resp/firmlist/FirmListResp.java new file mode 100644 index 0000000..759e645 --- /dev/null +++ b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/resp/firmlist/FirmListResp.java @@ -0,0 +1,135 @@ +package com.muyu.firmmanage.domain.resp.firmlist; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.muyu.firmmanage.domain.Firm; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Author:weiran + * @Package:com.muyu.firmmanage.domain.resp + * @Project:cloud-server-8 + * @name:FirmListResp + * @Date:2024/9/27 19:33 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class FirmListResp { + /** + * 用户ID + */ + private Long userId; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 用户账号 + */ + private String userName; + + /** + * 用户昵称 + */ + private String nickName; + + /** + * 用户类型(00系统用户) + */ + private String userType; + + /** + * 用户邮箱 + */ + private String email; + + /** + * 手机号码 + */ + private String phonenumber; + + /** + * 用户性别(0男 1女 2未知) + */ + private Integer sex; + + /** + * 头像地址 + */ + private String avatar; + + /** + * 密码 + */ + private String password; + + /** + * 帐号状态(0正常 1停用) + */ + private Integer status; + + /** + * 删除标志(0代表存在 2代表删除) + */ + private String delFlag; + + /** + * 最后登录IP + */ + private String loginIp; + + /** + * 最后登录时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date loginDate; + + /** + * 数据库名称 + */ + private String databaseName; + + /** + * 企业ID + */ + private Long firmId; + /** + * 企业名称 + */ + @TableField(exist = false) + private String firmName; + + /** + * 数据库对象构建为返回结果对象 + */ + public static FirmListResp firmListResp(Firm firm){ + return FirmListResp.builder() + .userId(firm.getUserId()) + .deptId(firm.getDeptId()) + .userName(firm.getUserName()) + .nickName(firm.getNickName()) + .userType((firm.getUserType())) + .email(firm.getEmail()) + .phonenumber(firm.getPhonenumber()) + .sex(firm.getSex()) + .avatar(firm.getAvatar()) + .password(firm.getPassword()) + .status(firm.getStatus()) + .delFlag(firm.getDelFlag()) + .loginDate(firm.getLoginDate()) + .databaseName(firm.getDatabaseName()) + .firmId(firm.getFirmId()) + .build(); + } + + +} diff --git a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/resp/firmlist/FirmTotalListResp.java b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/resp/firmlist/FirmTotalListResp.java new file mode 100644 index 0000000..849a0ce --- /dev/null +++ b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/domain/resp/firmlist/FirmTotalListResp.java @@ -0,0 +1,35 @@ +package com.muyu.firmmanage.domain.resp.firmlist; + +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @Author:weiran + * @Package:com.muyu.firmmanage.domain.resp.firmlist + * @Project:cloud-server-8 + * @name:FirmTotalListResp + * @Date:2024/9/27 19:42 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Tag(name = "公司数据总数列表",description = "数据总数响应") +public class FirmTotalListResp { + + private List firmListRespList; + + private long total; + + public static FirmTotalListResp firmTotalListResp(List firmListRespList,long toal){ + FirmTotalListResp firmTotalListResp = new FirmTotalListResp(); + firmTotalListResp.setFirmListRespList(firmListRespList); + firmTotalListResp.setTotal(toal); + return firmTotalListResp; + } +} diff --git a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/mapper/FirmManageMapper.java b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/mapper/FirmManageMapper.java index f8573ce..180a53c 100644 --- a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/mapper/FirmManageMapper.java +++ b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/mapper/FirmManageMapper.java @@ -1,7 +1,12 @@ package com.muyu.firmmanage.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.firmmanage.domain.Firm; +import com.muyu.firmmanage.domain.req.FirmListReq; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * @Author:weiran * @Package:com.muyu.firmmanage.mapper @@ -10,5 +15,7 @@ import org.apache.ibatis.annotations.Mapper; * @Date:2024/9/27 12:28 */ @Mapper -public interface FirmManageMapper { +public interface FirmManageMapper extends BaseMapper { + + List firmmessageList(FirmListReq firmListReq); } diff --git a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/service/FirmManageService.java b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/service/FirmManageService.java index d277dcc..0057e1c 100644 --- a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/service/FirmManageService.java +++ b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/service/FirmManageService.java @@ -1,5 +1,12 @@ package com.muyu.firmmanage.service; +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.firmmanage.domain.Firm; +import com.muyu.firmmanage.domain.req.FirmListReq; +import com.muyu.firmmanage.domain.resp.firmlist.FirmTotalListResp; + +import java.util.List; + /** * @Author:weiran * @Package:com.muyu.firmmanage.service @@ -7,5 +14,12 @@ package com.muyu.firmmanage.service; * @name:FirmManageService * @Date:2024/9/27 12:28 */ -public interface FirmManageService { +public interface FirmManageService extends IService { + + /** + * 公司列表信息展示 + * @param firmListReq + * @return + */ + FirmTotalListResp firmmessageList(FirmListReq firmListReq); } diff --git a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/service/impl/FirmManageServiceImpl.java b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/service/impl/FirmManageServiceImpl.java index 1c84c75..de7db96 100644 --- a/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/service/impl/FirmManageServiceImpl.java +++ b/cloud-modules/cloud-modules-firmmanage/src/main/java/com/muyu/firmmanage/service/impl/FirmManageServiceImpl.java @@ -1,8 +1,19 @@ package com.muyu.firmmanage.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.firmmanage.domain.Firm; +import com.muyu.firmmanage.domain.req.FirmListReq; +import com.muyu.firmmanage.domain.resp.firmlist.FirmListResp; +import com.muyu.firmmanage.domain.resp.firmlist.FirmTotalListResp; +import com.muyu.firmmanage.mapper.FirmManageMapper; import com.muyu.firmmanage.service.FirmManageService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * @Author:weiran * @Package:com.muyu.firmmanage.service.impl @@ -11,5 +22,26 @@ import org.springframework.stereotype.Service; * @Date:2024/9/27 12:28 */ @Service -public class FirmManageServiceImpl implements FirmManageService { +public class FirmManageServiceImpl extends ServiceImpl implements FirmManageService { + @Autowired + private FirmManageMapper firmManageMapper; + + /** + * 公司列表信息展示 + * @param firmListReq + * @return + */ + @Override + public FirmTotalListResp firmmessageList(FirmListReq firmListReq) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + long count = this.count(queryWrapper); + int offset=(firmListReq.getPageNum()-1)*firmListReq.getPageSize(); + firmListReq.setPageNum(offset); + List list = firmManageMapper.firmmessageList(firmListReq); + List firmListRespList = list.stream() + .map(FirmListResp::firmListResp) + .toList(); + return FirmTotalListResp.firmTotalListResp(firmListRespList, count); + + } } diff --git a/cloud-modules/cloud-modules-firmmanage/src/main/resources/bootstrap.yml b/cloud-modules/cloud-modules-firmmanage/src/main/resources/bootstrap.yml index 4a296f6..ad5441b 100644 --- a/cloud-modules/cloud-modules-firmmanage/src/main/resources/bootstrap.yml +++ b/cloud-modules/cloud-modules-firmmanage/src/main/resources/bootstrap.yml @@ -1,6 +1,6 @@ # Tomcat server: - port: 9701 + port: 9709 nacos: addr: 159.75.188.178:8848 diff --git a/cloud-modules/cloud-modules-firmmanage/src/main/resources/mapper/firmmanage/FirmManageMapepr.xml b/cloud-modules/cloud-modules-firmmanage/src/main/resources/mapper/firmmanage/FirmManageMapepr.xml new file mode 100644 index 0000000..4367c3b --- /dev/null +++ b/cloud-modules/cloud-modules-firmmanage/src/main/resources/mapper/firmmanage/FirmManageMapepr.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + sys_user.*, + firm.* + FROM + sys_user + LEFT JOIN firm ON sys_user.firm_id = firm.firm_id + + + + + + +