企业信息

WeiRan 2024-09-28 14:23:30 +08:00
parent e0e0923397
commit a0ed4ee252
12 changed files with 455 additions and 11 deletions

View File

@ -61,12 +61,6 @@
<artifactId>cloud-common-datascope</artifactId>
</dependency>
<!-- MuYu Common Log -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-log</artifactId>
</dependency>
<!-- 接口模块 -->
<dependency>
<groupId>com.muyu</groupId>

View File

@ -0,0 +1,18 @@
package com.muyu.firmmanage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @Authorweiran
* @Packagecom.muyu.firmmanage
* @Projectcloud-server-8
* @nameFirmManageApplication
* @Date2024/9/27 21:19
*/
@SpringBootApplication
public class FirmManageApplication {
public static void main(String[] args) {
SpringApplication.run(FirmManageApplication.class, args);
}
}

View File

@ -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);
}
}

View File

@ -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;
/**
* @Authorweiran
* @Packagecom.muyu.firmmanage.domain
@ -12,9 +19,97 @@ import lombok.experimental.SuperBuilder;
* @nameFirm
* @Date2024/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;
}

View File

@ -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;
/**
* @Authorweiran
* @Packagecom.muyu.firmmanage.domain.req
* @Projectcloud-server-8
* @nameFirmListReq
* @Date2024/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;
}

View File

@ -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;
/**
* @Authorweiran
* @Packagecom.muyu.firmmanage.domain.resp
* @Projectcloud-server-8
* @nameFirmListResp
* @Date2024/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();
}
}

View File

@ -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;
/**
* @Authorweiran
* @Packagecom.muyu.firmmanage.domain.resp.firmlist
* @Projectcloud-server-8
* @nameFirmTotalListResp
* @Date2024/9/27 19:42
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "公司数据总数列表",description = "数据总数响应")
public class FirmTotalListResp {
private List<FirmListResp> firmListRespList;
private long total;
public static FirmTotalListResp firmTotalListResp(List<FirmListResp> firmListRespList,long toal){
FirmTotalListResp firmTotalListResp = new FirmTotalListResp();
firmTotalListResp.setFirmListRespList(firmListRespList);
firmTotalListResp.setTotal(toal);
return firmTotalListResp;
}
}

View File

@ -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;
/**
* @Authorweiran
* @Packagecom.muyu.firmmanage.mapper
@ -10,5 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
* @Date2024/9/27 12:28
*/
@Mapper
public interface FirmManageMapper {
public interface FirmManageMapper extends BaseMapper<Firm> {
List<Firm> firmmessageList(FirmListReq firmListReq);
}

View File

@ -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;
/**
* @Authorweiran
* @Packagecom.muyu.firmmanage.service
@ -7,5 +14,12 @@ package com.muyu.firmmanage.service;
* @nameFirmManageService
* @Date2024/9/27 12:28
*/
public interface FirmManageService {
public interface FirmManageService extends IService<Firm> {
/**
*
* @param firmListReq
* @return
*/
FirmTotalListResp firmmessageList(FirmListReq firmListReq);
}

View File

@ -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;
/**
* @Authorweiran
* @Packagecom.muyu.firmmanage.service.impl
@ -11,5 +22,26 @@ import org.springframework.stereotype.Service;
* @Date2024/9/27 12:28
*/
@Service
public class FirmManageServiceImpl implements FirmManageService {
public class FirmManageServiceImpl extends ServiceImpl<FirmManageMapper,Firm> implements FirmManageService {
@Autowired
private FirmManageMapper firmManageMapper;
/**
*
* @param firmListReq
* @return
*/
@Override
public FirmTotalListResp firmmessageList(FirmListReq firmListReq) {
LambdaQueryWrapper<Firm> queryWrapper = new LambdaQueryWrapper<>();
long count = this.count(queryWrapper);
int offset=(firmListReq.getPageNum()-1)*firmListReq.getPageSize();
firmListReq.setPageNum(offset);
List<Firm> list = firmManageMapper.firmmessageList(firmListReq);
List<FirmListResp> firmListRespList = list.stream()
.map(FirmListResp::firmListResp)
.toList();
return FirmTotalListResp.firmTotalListResp(firmListRespList, count);
}
}

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9701
port: 9709
nacos:
addr: 159.75.188.178:8848

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.firmmanage.mapper.FirmManageMapper">
<resultMap id="FirmListResult" type="com.muyu.firmmanage.domain.Firm">
<id property="userId" column="user_id"></id>
<result property="deptId" column="dept_id"></result>
<result property="userName" column="user_name"></result>
<result property="nickName" column="nick_name"></result>
<result property="userType" column="user_type"></result>
<result property="email" column="email"></result>
<result property="phonenumber" column="phonenumber"></result>
<result property="sex" column="sex"></result>
<result property="avatar" column="avatar"></result>
<result property="password" column="password"></result>
<result property="status" column="status"></result>
<result property="delFlag" column="del_flag"></result>
<result property="loginIp" column="login_ip"></result>
<result property="loginDate" column="login_date"></result>
<result property="databaseName" column="database_name"></result>
<result property="firmId" column="firm_id"></result>
<result property="firmName" column="firm_name"></result>
</resultMap>
<sql id="selectFirmManage">
SELECT
sys_user.*,
firm.*
FROM
sys_user
LEFT JOIN firm ON sys_user.firm_id = firm.firm_id
</sql>
<select id="firmmessageList" resultType="com.muyu.firmmanage.domain.Firm">
<include refid="selectFirmManage"></include>
<where>
<if test="firmName!=null and firmName!=''">
and firm.firm_name=#{firmName}
</if>
</where>
limit #{pageNum},#{pageSize}
</select>
</mapper>