Compare commits
2 Commits
5a31fd5eca
...
6cf79591f7
Author | SHA1 | Date |
---|---|---|
|
6cf79591f7 | |
|
b7975ee9dd |
|
@ -0,0 +1,48 @@
|
|||
package com.muyu.company.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;
|
||||
|
||||
/**
|
||||
* 认证表
|
||||
*
|
||||
* @ClassName Authentication
|
||||
* @Author AnNan.Wang
|
||||
* @Date 2024/5/28 21:12
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("authentication")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Authentication extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 企业认证主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 审核报告人
|
||||
*/
|
||||
private String auditor;
|
||||
/**
|
||||
* 待审核,已通过,未通过
|
||||
*/
|
||||
private String stat;
|
||||
/**
|
||||
* 审核报告
|
||||
*/
|
||||
private String auditReason;
|
||||
}
|
|
@ -1,20 +1,15 @@
|
|||
package com.muyu.company.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -27,71 +22,67 @@ import java.util.Date;
|
|||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("company")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Company extends BaseEntity
|
||||
{
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
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 String businessLicenseNumber;
|
||||
/**
|
||||
* 企业成立的日期
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* 企业认证主键
|
||||
*/
|
||||
private Long authenticationId;
|
||||
/**
|
||||
* 开通服务主键
|
||||
*/
|
||||
private Long liberalServiceId;
|
||||
/**
|
||||
* 增值服务主键
|
||||
*/
|
||||
private Long appreciationServiceId;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.muyu.company.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;
|
||||
|
||||
/**
|
||||
* 开通服务表
|
||||
*
|
||||
* @ClassName Liberal
|
||||
* @Author AnNan.Wang
|
||||
* @Date 2024/5/28 21:31
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("liberal")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Liberal extends BaseEntity {
|
||||
private static final long serialVersionUID =1L;
|
||||
|
||||
/**
|
||||
* 开通主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 1开通 2未开通
|
||||
*/
|
||||
private String activateTheService;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.muyu.company.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 支付表
|
||||
*
|
||||
* @ClassName Pay
|
||||
* @Author AnNan.Wang
|
||||
* @Date 2024/5/28 21:33
|
||||
*/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("pay")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Pay extends BaseEntity {
|
||||
private static final long serialVersionUID =1L;
|
||||
|
||||
/**
|
||||
* 支付主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 企业主键
|
||||
*/
|
||||
private Long companyId;
|
||||
/**
|
||||
* 支付方式主键
|
||||
*/
|
||||
private Long paymentId;
|
||||
/**
|
||||
* 增值需要支付的价格
|
||||
*/
|
||||
private Double appreciationDecimal;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.muyu.company.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;
|
||||
|
||||
/**
|
||||
* 支付方式表
|
||||
*
|
||||
* @ClassName Payment
|
||||
* @Author AnNan.Wang
|
||||
* @Date 2024/5/28 21:51
|
||||
*/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("payment")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Payment extends BaseEntity {
|
||||
private static final long serialVersionUID =1L;
|
||||
|
||||
/**
|
||||
* 支付方式主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
private String payment;
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
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;
|
||||
}
|
|
@ -12,6 +12,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* @author muyu
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuCompanyApplication {
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
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));
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
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);
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
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);
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
<?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>
|
|
@ -82,25 +82,16 @@ public class SysDeptController extends BaseController {
|
|||
@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)) {
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
} else if (dept.getParentId().equals(deptId)) {
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
||||
return error("该部门包含未停用的子部门!");
|
||||
}
|
||||
Long deptId = dept.getDeptId();
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
if (!deptService.checkDeptNameUnique(dept)) {
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
} else if (dept.getParentId().equals(deptId)) {
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
||||
return error("该部门包含未停用的子部门!");
|
||||
}
|
||||
|
||||
dept.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
|
|
@ -205,35 +205,13 @@ 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())) {
|
||||
throw new ServiceException("部门停用,不允许新增");
|
||||
}
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
return deptMapper.insertDept(dept);
|
||||
SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
||||
// 如果父节点不为正常状态,则不允许新增子节点
|
||||
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
|
||||
throw new ServiceException("部门停用,不允许新增");
|
||||
}
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
return deptMapper.insertDept(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -245,45 +223,21 @@ 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)) {
|
||||
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
|
||||
String oldAncestors = oldDept.getAncestors();
|
||||
dept.setAncestors(newAncestors);
|
||||
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
|
||||
}
|
||||
int result = deptMapper.updateDept(dept);
|
||||
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
|
||||
&& !StringUtils.equals("0", dept.getAncestors())) {
|
||||
// 如果该部门是启用状态,则启用该部门的所有上级部门
|
||||
updateParentDeptStatusNormal(dept);
|
||||
}
|
||||
return result;
|
||||
SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
|
||||
SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
|
||||
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
|
||||
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
|
||||
String oldAncestors = oldDept.getAncestors();
|
||||
dept.setAncestors(newAncestors);
|
||||
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
|
||||
}
|
||||
int result = deptMapper.updateDept(dept);
|
||||
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
|
||||
&& !StringUtils.equals("0", dept.getAncestors())) {
|
||||
// 如果该部门是启用状态,则启用该部门的所有上级部门
|
||||
updateParentDeptStatusNormal(dept);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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">parent_id,</if>
|
||||
<if test="parentId != null and parentId != 0">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">#{parentId},</if>
|
||||
<if test="parentId != null and parentId != 0">#{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">parent_id = #{parentId},</if>
|
||||
<if test="parentId != null and parentId != 0">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>
|
||||
|
|
Loading…
Reference in New Issue