feat(新增运营平台和业务平台登录,新增对应企业展示)

master
DongZeLiang 2023-11-14 10:28:16 +08:00 committed by 031026
parent 1612ffd84b
commit 0a698e18a4
30 changed files with 1092 additions and 58 deletions

View File

@ -6,7 +6,7 @@ server:
spring:
application:
# 应用名称
name: muyu-auth
name: ruoyi-auth
profiles:
# 环境配置
active: dev
@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -9,15 +9,15 @@ public class ServiceNameConstants {
/**
* serviceid
*/
public static final String AUTH_SERVICE = "muyu-auth";
public static final String AUTH_SERVICE = "ruoyi-auth";
/**
* serviceid
*/
public static final String SYSTEM_SERVICE = "muyu-system";
public static final String SYSTEM_SERVICE = "ruoyi-system";
/**
* serviceid
*/
public static final String FILE_SERVICE = "muyu-file";
public static final String FILE_SERVICE = "ruoyi-file";
}

View File

@ -6,7 +6,7 @@ server:
spring:
application:
# 应用名称
name: muyu-gateway
name: ruoyi-gateway
profiles:
# 环境配置
active: dev
@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
# 配置文件格式
file-extension: yml
# 共享配置
@ -33,7 +33,7 @@ spring:
datasource:
ds1:
nacos:
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
dataId: sentinel-muyu-gateway
groupId: DEFAULT_GROUP
data-type: json

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>muyu-company</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>muyu-company-common</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- 系统公共核心包 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-security</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,97 @@
package com.muyu.company.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.company.domain.vo.CompanyVo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serial;
import java.util.Date;
/**
* company company
*
* @author wan
* @date 2024-05-26
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class Company extends BaseEntity
{
@Serial
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 企业名称 */
@Excel(name = "企业名称")
private String companyName;
/** 法定代表人 */
@Excel(name = "法定代表人")
private String legalRepresentative;
/** 企业成立时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "企业成立时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date companyTime;
/** 业务范围 */
@Excel(name = "业务范围")
private String sphereOfBusiness;
/** 注册地址 */
@Excel(name = "注册地址")
private String registeredAddress;
/** 企业联系电话 */
@Excel(name = "企业联系电话")
private String companyPhone;
/** 公司邮箱 */
@Excel(name = "公司邮箱")
private String companyMailbox;
/** 公司营业执照 */
@Excel(name = "公司营业执照")
private String businessLicense;
/** 税务登记证 */
@Excel(name = "税务登记证")
private String taxRegistrationCertificate;
/** 企业状态 */
@Excel(name = "企业状态")
private String companyStatus;
/** 企业入驻时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "企业入驻时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date enterTime;
/** 是否认证 */
@Excel(name = "是否认证")
private String isAuthentication;
/** 认证时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "认证时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date authenticationTime;
/** 服务等级 */
@Excel(name = "服务等级")
private Long serviceLevel;
}

View File

@ -0,0 +1,30 @@
package com.muyu.company.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.Date;
/**
* company company
*
* @author wan
* @date 2024-05-26
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class CompanyVo
{
private String deptName;
private String roleKey;
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>muyu-company</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>muyu-company-remove</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>muyu-company</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>muyu-company-server</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- MuYu Common DataSource -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-datasource</artifactId>
</dependency>
<!-- MuYu Common DataScope -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-datascope</artifactId>
</dependency>
<!-- MuYu Common Log -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-log</artifactId>
</dependency>
<!-- MuYu Common Swagger -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.20</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-company-common</artifactId>
<version>3.6.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,21 @@
package com.muyu.company;
import com.muyu.common.security.annotation.EnableCustomConfig;
import com.muyu.common.security.annotation.EnableMyFeignClients;
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
*
*
* @author muyu
*/
@EnableCustomConfig
@EnableMyFeignClients
@SpringBootApplication
public class MuYuCompanyApplication {
public static void main (String[] args) {
SpringApplication.run(MuYuCompanyApplication.class, args);
}
}

View File

@ -0,0 +1,86 @@
package com.muyu.company.controller;
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.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.company.domain.Company;
import com.muyu.company.domain.vo.CompanyVo;
import com.muyu.company.service.ICompanyService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* companyController
*
* @author wan
* @date 2024-05-26
*/
@RestController
@RequestMapping("/company")
public class CompanyController extends BaseController
{
@Autowired
private ICompanyService companyService;
/**
* company
*/
@ApiOperation("获取企业列表")
@RequiresPermissions("company:company:list")
@GetMapping("/list")
public Result<TableDataInfo<Company>> list(CompanyVo company){
startPage();
System.out.println(company);
List<Company> list = companyService.selectCompanyList(company);
return getDataTable(list);
}
/**
* company
*/
@RequiresPermissions("company:company:query")
@GetMapping(value = "/{id}")
public Result getInfo(@PathVariable("id") Long id)
{
return success(companyService.selectCompanyById(id));
}
/**
* company
*/
@RequiresPermissions("company:company:add")
@Log(title = "company", businessType = BusinessType.INSERT)
@PostMapping
public Result add(@RequestBody Company company)
{
return toAjax(companyService.insertCompany(company));
}
/**
* company
*/
@RequiresPermissions("company:company:edit")
@Log(title = "company", businessType = BusinessType.UPDATE)
@PutMapping
public Result edit(@RequestBody Company company)
{
return toAjax(companyService.updateCompany(company));
}
/**
* company
*/
@RequiresPermissions("company:company:remove")
@Log(title = "company", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public Result remove(@PathVariable Long[] ids)
{
return toAjax(companyService.deleteCompanyByIds(ids));
}
}

View File

@ -0,0 +1,63 @@
package com.muyu.company.mapper;
import com.muyu.company.domain.Company;
import com.muyu.company.domain.vo.CompanyVo;
import java.util.List;
/**
* companyMapper
*
* @author wan
* @date 2024-05-26
*/
public interface CompanyMapper
{
/**
* company
*
* @param id company
* @return company
*/
public Company selectCompanyById(Long id);
/**
* company
*
* @param company company
* @return company
*/
public List<Company> selectCompanyList(CompanyVo company);
/**
* company
*
* @param company company
* @return
*/
public int insertCompany(Company company);
/**
* company
*
* @param company company
* @return
*/
public int updateCompany(Company company);
/**
* company
*
* @param id company
* @return
*/
public int deleteCompanyById(Long id);
/**
* company
*
* @param ids
* @return
*/
public int deleteCompanyByIds(Long[] ids);
}

View File

@ -0,0 +1,63 @@
package com.muyu.company.service;
import com.muyu.company.domain.Company;
import com.muyu.company.domain.vo.CompanyVo;
import java.util.List;
/**
* companyService
*
* @author wan
* @date 2024-05-26
*/
public interface ICompanyService
{
/**
* company
*
* @param id company
* @return company
*/
public Company selectCompanyById(Long id);
/**
* company
*
* @param company company
* @return company
*/
public List<Company> selectCompanyList(CompanyVo company);
/**
* company
*
* @param company company
* @return
*/
public int insertCompany(Company company);
/**
* company
*
* @param company company
* @return
*/
public int updateCompany(Company company);
/**
* company
*
* @param ids company
* @return
*/
public int deleteCompanyByIds(Long[] ids);
/**
* company
*
* @param id company
* @return
*/
public int deleteCompanyById(Long id);
}

View File

@ -0,0 +1,98 @@
package com.muyu.company.service.impl;
import com.muyu.common.core.utils.DateUtils;
import com.muyu.company.domain.Company;
import com.muyu.company.domain.vo.CompanyVo;
import com.muyu.company.mapper.CompanyMapper;
import com.muyu.company.service.ICompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* companyService
*
* @author wan
* @date 2024-05-26
*/
@Service
public class CompanyServiceImpl implements ICompanyService
{
@Autowired
private CompanyMapper companyMapper;
/**
* company
*
* @param id company
* @return company
*/
@Override
public Company selectCompanyById(Long id)
{
return companyMapper.selectCompanyById(id);
}
/**
* company
*
* @param company company
* @return company
*/
@Override
public List<Company> selectCompanyList(CompanyVo company)
{
return companyMapper.selectCompanyList(company);
}
/**
* company
*
* @param company company
* @return
*/
@Override
public int insertCompany(Company company)
{
return companyMapper.insertCompany(company);
}
/**
* company
*
* @param company company
* @return
*/
@Override
public int updateCompany(Company company)
{
company.setUpdateTime(DateUtils.getNowDate());
return companyMapper.updateCompany(company);
}
/**
* company
*
* @param ids company
* @return
*/
@Override
public int deleteCompanyByIds(Long[] ids)
{
return companyMapper.deleteCompanyByIds(ids);
}
/**
* company
*
* @param id company
* @return
*/
@Override
public int deleteCompanyById(Long id)
{
return companyMapper.deleteCompanyById(id);
}
}

View File

@ -0,0 +1,2 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}

View File

@ -0,0 +1,25 @@
# Tomcat
server:
port: 9400
# Spring
spring:
application:
# 应用名称
name: ruoyi-company
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 101.34.243.166:8848
config:
# 配置中心地址
server-addr: 101.34.243.166:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/muyu-company-server"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,115 @@
<?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.company.mapper.CompanyMapper">
<resultMap type="com.muyu.company.domain.Company" id="CompanyResult">
<result property="id" column="id" />
<result property="companyName" column="company_name" />
<result property="legalRepresentative" column="legal_representative" />
<result property="companyTime" column="company_time" />
<result property="sphereOfBusiness" column="sphere_of_business" />
<result property="registeredAddress" column="registered_address" />
<result property="companyPhone" column="company_phone" />
<result property="companyMailbox" column="company_mailbox" />
<result property="businessLicense" column="business_license" />
<result property="taxRegistrationCertificate" column="tax_registration_certificate" />
<result property="companyStatus" column="company_status" />
<result property="enterTime" column="enter_time" />
<result property="isAuthentication" column="is_authentication" />
<result property="authenticationTime" column="authentication_time" />
<result property="serviceLevel" column="service_level" />
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectCompanyVo">
select id, company_name, legal_representative, company_time, sphere_of_business, registered_address, company_phone, company_mailbox, business_license, tax_registration_certificate, company_status, enter_time, is_authentication, authentication_time, service_level, remark, create_by, create_time, update_by, update_time from company
</sql>
<select id="selectCompanyList" parameterType="com.muyu.company.domain.Company" resultMap="CompanyResult">
<include refid="selectCompanyVo"/>
<where>
<if test="roleKey != null and roleKey != '' and roleKey == 'common' || roleKey == 'employee'">
and company_name = #{deptName}
</if>
</where>
</select>
<select id="selectCompanyById" parameterType="Long" resultMap="CompanyResult">
<include refid="selectCompanyVo"/>
where id = #{id}
</select>
<insert id="insertCompany" parameterType="com.muyu.company.domain.Company" useGeneratedKeys="true" keyProperty="id">
insert into company
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyName != null">company_name,</if>
<if test="legalRepresentative != null">legal_representative,</if>
<if test="companyTime != null">company_time,</if>
<if test="sphereOfBusiness != null">sphere_of_business,</if>
<if test="registeredAddress != null">registered_address,</if>
<if test="companyPhone != null">company_phone,</if>
<if test="companyMailbox != null">company_mailbox,</if>
<if test="businessLicense != null">business_license,</if>
<if test="taxRegistrationCertificate != null">tax_registration_certificate,</if>
<if test="companyStatus != null">company_status,</if>
<if test="enterTime != null">enter_time,</if>
<if test="isAuthentication != null">is_authentication,</if>
<if test="authenticationTime != null">authentication_time,</if>
<if test="serviceLevel != null">service_level,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyName != null">#{companyName},</if>
<if test="legalRepresentative != null">#{legalRepresentative},</if>
<if test="companyTime != null">#{companyTime},</if>
<if test="sphereOfBusiness != null">#{sphereOfBusiness},</if>
<if test="registeredAddress != null">#{registeredAddress},</if>
<if test="companyPhone != null">#{companyPhone},</if>
<if test="companyMailbox != null">#{companyMailbox},</if>
<if test="businessLicense != null">#{businessLicense},</if>
<if test="taxRegistrationCertificate != null">#{taxRegistrationCertificate},</if>
<if test="companyStatus != null">#{companyStatus},</if>
<if test="enterTime != null">#{enterTime},</if>
<if test="isAuthentication != null">#{isAuthentication},</if>
<if test="authenticationTime != null">#{authenticationTime},</if>
<if test="serviceLevel != null">#{serviceLevel},</if>
</trim>
</insert>
<update id="updateCompany" parameterType="com.muyu.company.domain.Company">
update company
<trim prefix="SET" suffixOverrides=",">
<if test="companyName != null">company_name = #{companyName},</if>
<if test="legalRepresentative != null">legal_representative = #{legalRepresentative},</if>
<if test="companyTime != null">company_time = #{companyTime},</if>
<if test="sphereOfBusiness != null">sphere_of_business = #{sphereOfBusiness},</if>
<if test="registeredAddress != null">registered_address = #{registeredAddress},</if>
<if test="companyPhone != null">company_phone = #{companyPhone},</if>
<if test="companyMailbox != null">company_mailbox = #{companyMailbox},</if>
<if test="businessLicense != null">business_license = #{businessLicense},</if>
<if test="taxRegistrationCertificate != null">tax_registration_certificate = #{taxRegistrationCertificate},</if>
<if test="companyStatus != null">company_status = #{companyStatus},</if>
<if test="enterTime != null">enter_time = #{enterTime},</if>
<if test="isAuthentication != null">is_authentication = #{isAuthentication},</if>
<if test="authenticationTime != null">authentication_time = #{authenticationTime},</if>
<if test="serviceLevel != null">service_level = #{serviceLevel},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCompanyById" parameterType="Long">
delete from company where id = #{id}
</delete>
<delete id="deleteCompanyByIds" parameterType="String">
delete from company where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>muyu-modules</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>muyu-company</artifactId>
<packaging>pom</packaging>
<modules>
<module>muyu-company-common</module>
<module>muyu-company-remove</module>
<module>muyu-company-server</module>
</modules>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -6,7 +6,7 @@ server:
spring:
application:
# 应用名称
name: muyu-file
name: ruoyi-file
profiles:
# 环境配置
active: dev
@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -6,7 +6,7 @@ server:
spring:
application:
# 应用名称
name: muyu-gen
name: ruoyi-gen
profiles:
# 环境配置
active: dev
@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -6,7 +6,7 @@ server:
spring:
application:
# 应用名称
name: muyu-job
name: ruoyi-job
profiles:
# 环境配置
active: dev
@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -81,6 +81,16 @@ public class SysDeptController extends BaseController {
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public Result edit (@Validated @RequestBody SysDept dept) {
if (dept.getParentId()==null) {
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept)) {
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
return error("该部门包含未停用的子部门!");
}
}else {
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept)) {
@ -90,6 +100,7 @@ public class SysDeptController extends BaseController {
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
return error("该部门包含未停用的子部门!");
}
}
dept.setUpdateBy(SecurityUtils.getUsername());
return toAjax(deptService.updateDept(dept));
}

View File

@ -205,6 +205,27 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
*/
@Override
public int insertDept (SysDept dept) {
Long id = null;
if (dept.getParentId()==null) {
id =0L;
return deptMapper.insertDept(
SysDept.builder()
.deptId(null)
.parentId(id)
.ancestors(String.valueOf(id))
.deptName(dept.getDeptName())
.orderNum(dept.getOrderNum())
.leader(dept.getLeader())
.phone(dept.getPhone())
.email(dept.getEmail())
.status(dept.getStatus())
.delFlag(dept.getDelFlag())
.parentName(dept.getParentName())
.createBy(dept.getCreateBy())
.build()
);
}else {
SysDept info = deptMapper.selectDeptById(dept.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
@ -213,6 +234,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
return deptMapper.insertDept(dept);
}
}
/**
*
@ -223,6 +245,29 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
*/
@Override
public int updateDept (SysDept dept) {
Long id = null;
if (dept.getParentId() == null) {
id =0L;
dept.setUpdateBy(SecurityUtils.getUsername());
int result = deptMapper.updateDept(
SysDept.builder()
.deptId(dept.getDeptId())
.parentId(id)
.ancestors(String.valueOf(id))
.deptName(dept.getDeptName())
.orderNum(dept.getOrderNum())
.leader(dept.getLeader())
.phone(dept.getPhone())
.email(dept.getEmail())
.status(dept.getStatus())
.delFlag(dept.getDelFlag())
.parentName(dept.getParentName())
.updateBy(dept.getUpdateBy())
.build()
);
return result;
}else {
SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
@ -239,6 +284,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
}
return result;
}
}
/**
*

View File

@ -6,7 +6,7 @@ server:
spring:
application:
# 应用名称
name: muyu-system
name: ruoyi-system
profiles:
# 环境配置
active: dev
@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -112,7 +112,7 @@
<insert id="insertDept" parameterType="com.muyu.common.system.domain.SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="parentId != null">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
@ -124,7 +124,7 @@
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="parentId != null">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
@ -140,7 +140,7 @@
<update id="updateDept" parameterType="com.muyu.common.system.domain.SysDept">
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>

View File

@ -13,6 +13,7 @@
<module>muyu-gen</module>
<module>muyu-job</module>
<module>muyu-file</module>
<module>muyu-company</module>
</modules>
<artifactId>muyu-modules</artifactId>

View File

@ -6,7 +6,7 @@ server:
spring:
application:
# 应用名称
name: muyu-monitor
name: ruoyi-monitor
profiles:
# 环境配置
active: dev
@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 101.34.243.166:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -0,0 +1,128 @@
<?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.company.mapper.CompanyMapper">
<resultMap type="Company" id="CompanyResult">
<result property="id" column="id" />
<result property="companyName" column="company_name" />
<result property="legalRepresentative" column="legal_representative" />
<result property="companyTime" column="company_time" />
<result property="sphereOfBusiness" column="sphere_of_business" />
<result property="registeredAddress" column="registered_address" />
<result property="companyPhone" column="company_phone" />
<result property="companyMailbox" column="company_mailbox" />
<result property="businessLicense" column="business_license" />
<result property="taxRegistrationCertificate" column="tax_registration_certificate" />
<result property="companyStatus" column="company_status" />
<result property="enterTime" column="enter_time" />
<result property="isAuthentication" column="is_authentication" />
<result property="authenticationTime" column="authentication_time" />
<result property="serviceLevel" column="service_level" />
<result property="remark" column="remark" />
<result property="foundName" column="found_name" />
<result property="foundTime" column="found_time" />
<result property="updateName" column="update_name" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectCompanyVo">
select id, company_name, legal_representative, company_time, sphere_of_business, registered_address, company_phone, company_mailbox, business_license, tax_registration_certificate, company_status, enter_time, is_authentication, authentication_time, service_level, remark, found_name, found_time, update_name, update_time from company
</sql>
<select id="selectCompanyList" parameterType="Company" resultMap="CompanyResult">
<include refid="selectCompanyVo"/>
<where>
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
</where>
</select>
<select id="selectCompanyById" parameterType="Long" resultMap="CompanyResult">
<include refid="selectCompanyVo"/>
where id = #{id}
</select>
<insert id="insertCompany" parameterType="Company" useGeneratedKeys="true" keyProperty="id">
insert into company
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyName != null">company_name,</if>
<if test="legalRepresentative != null">legal_representative,</if>
<if test="companyTime != null">company_time,</if>
<if test="sphereOfBusiness != null">sphere_of_business,</if>
<if test="registeredAddress != null">registered_address,</if>
<if test="companyPhone != null">company_phone,</if>
<if test="companyMailbox != null">company_mailbox,</if>
<if test="businessLicense != null">business_license,</if>
<if test="taxRegistrationCertificate != null">tax_registration_certificate,</if>
<if test="companyStatus != null">company_status,</if>
<if test="enterTime != null">enter_time,</if>
<if test="isAuthentication != null">is_authentication,</if>
<if test="authenticationTime != null">authentication_time,</if>
<if test="serviceLevel != null">service_level,</if>
<if test="remark != null">remark,</if>
<if test="foundName != null">found_name,</if>
<if test="foundTime != null">found_time,</if>
<if test="updateName != null">update_name,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyName != null">#{companyName},</if>
<if test="legalRepresentative != null">#{legalRepresentative},</if>
<if test="companyTime != null">#{companyTime},</if>
<if test="sphereOfBusiness != null">#{sphereOfBusiness},</if>
<if test="registeredAddress != null">#{registeredAddress},</if>
<if test="companyPhone != null">#{companyPhone},</if>
<if test="companyMailbox != null">#{companyMailbox},</if>
<if test="businessLicense != null">#{businessLicense},</if>
<if test="taxRegistrationCertificate != null">#{taxRegistrationCertificate},</if>
<if test="companyStatus != null">#{companyStatus},</if>
<if test="enterTime != null">#{enterTime},</if>
<if test="isAuthentication != null">#{isAuthentication},</if>
<if test="authenticationTime != null">#{authenticationTime},</if>
<if test="serviceLevel != null">#{serviceLevel},</if>
<if test="remark != null">#{remark},</if>
<if test="foundName != null">#{foundName},</if>
<if test="foundTime != null">#{foundTime},</if>
<if test="updateName != null">#{updateName},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateCompany" parameterType="Company">
update company
<trim prefix="SET" suffixOverrides=",">
<if test="companyName != null">company_name = #{companyName},</if>
<if test="legalRepresentative != null">legal_representative = #{legalRepresentative},</if>
<if test="companyTime != null">company_time = #{companyTime},</if>
<if test="sphereOfBusiness != null">sphere_of_business = #{sphereOfBusiness},</if>
<if test="registeredAddress != null">registered_address = #{registeredAddress},</if>
<if test="companyPhone != null">company_phone = #{companyPhone},</if>
<if test="companyMailbox != null">company_mailbox = #{companyMailbox},</if>
<if test="businessLicense != null">business_license = #{businessLicense},</if>
<if test="taxRegistrationCertificate != null">tax_registration_certificate = #{taxRegistrationCertificate},</if>
<if test="companyStatus != null">company_status = #{companyStatus},</if>
<if test="enterTime != null">enter_time = #{enterTime},</if>
<if test="isAuthentication != null">is_authentication = #{isAuthentication},</if>
<if test="authenticationTime != null">authentication_time = #{authenticationTime},</if>
<if test="serviceLevel != null">service_level = #{serviceLevel},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="foundName != null">found_name = #{foundName},</if>
<if test="foundTime != null">found_time = #{foundTime},</if>
<if test="updateName != null">update_name = #{updateName},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCompanyById" parameterType="Long">
delete from company where id = #{id}
</delete>
<delete id="deleteCompanyByIds" parameterType="String">
delete from company where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -10,7 +10,7 @@
<name>muyu</name>
<description>若依微服务系统</description>
<description>微服务系统</description>
<properties>
<muyu.version>3.6.3</muyu.version>
@ -205,7 +205,6 @@
<artifactId>muyu-common-system</artifactId>
<version>${muyu.version}</version>
</dependency>
</dependencies>
</dependencyManagement>