增加machineCode机具编码
This commit is contained in:
parent
0508383e8d
commit
7b0b4c4420
|
|
@ -1,16 +1,16 @@
|
|||
package com.bonus.sgzb.system.api.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门表 sys_dept
|
||||
|
|
|
|||
|
|
@ -1,18 +1,5 @@
|
|||
package com.bonus.sgzb.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bonus.sgzb.common.core.constant.UserConstants;
|
||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||
|
|
@ -23,6 +10,12 @@ import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
|
|||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.system.api.domain.SysDept;
|
||||
import com.bonus.sgzb.system.service.ISysDeptService;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
|
|
@ -91,7 +84,16 @@ public class SysDeptController extends BaseController {
|
|||
return toAjax(deptService.insertCompanies(list));
|
||||
}
|
||||
|
||||
|
||||
// @RequiresPermissions("system:dept:add")
|
||||
@Log(title = "公司管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "/addFirm")
|
||||
public AjaxResult addFirm(@RequestBody SysDept sysDept) {
|
||||
logger.info("新增公司");
|
||||
if (!deptService.checkCompanyNameUnique(sysDept)) {
|
||||
return error("新增公司失败,公司名称已存在");
|
||||
}
|
||||
return toAjax(deptService.insertCompany(sysDept));
|
||||
}
|
||||
/**
|
||||
* 新增部门
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
package com.bonus.sgzb.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.bonus.sgzb.system.api.domain.SysDept;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门管理 数据层
|
||||
|
|
@ -130,4 +131,8 @@ public interface SysDeptMapper
|
|||
String getCompanyByAncestors(String split);
|
||||
|
||||
int getMaxDeptId();
|
||||
|
||||
int checkCompanyNameUnique(SysDept list);
|
||||
|
||||
int insertCompany(SysDept list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
package com.bonus.sgzb.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bonus.sgzb.system.api.domain.SysDept;
|
||||
import com.bonus.sgzb.system.domain.vo.TreeSelect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门管理 服务层
|
||||
*
|
||||
|
|
@ -126,4 +127,11 @@ public interface ISysDeptService
|
|||
public int deleteDeptById(Long deptId);
|
||||
|
||||
String getCompanyByAncestors(String ancestors);
|
||||
|
||||
/*
|
||||
* 新增公司
|
||||
* */
|
||||
public boolean checkCompanyNameUnique(SysDept list);
|
||||
|
||||
int insertCompany(SysDept list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import com.bonus.sgzb.system.mapper.SysDeptMapper;
|
|||
import com.bonus.sgzb.system.mapper.SysRoleMapper;
|
||||
import com.bonus.sgzb.system.mapper.SysUserMapper;
|
||||
import com.bonus.sgzb.system.service.ISysDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -316,6 +315,32 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkCompanyNameUnique(SysDept list) {
|
||||
int count = deptMapper.checkCompanyNameUnique(list);
|
||||
return count == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertCompany(SysDept list) {
|
||||
// long num = deptMapper.getMaxDeptId()+1;
|
||||
SysDept dept = new SysDept();
|
||||
String deptName = list.getDeptName();
|
||||
dept.setDeptName(deptName);
|
||||
dept.setSocialCreditCode(list.getSocialCreditCode());
|
||||
dept.setEnterpriseOwnershipCode(list.getEnterpriseOwnershipCode());
|
||||
dept.setCreateBy(SecurityUtils.getUsername());
|
||||
dept.setParentId(0L);
|
||||
dept.setAncestors("0");
|
||||
dept.setOrderNum(999);
|
||||
dept.setStatus("0");
|
||||
// long nextMultiple = (int) Math.ceil((double) num / 100) * 100;
|
||||
// num = nextMultiple + 1;
|
||||
// dept.setDeptId(nextMultiple);
|
||||
// dept.setCompanyId(nextMultiple);
|
||||
return deptMapper.insertCompany(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -143,6 +143,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertCompany" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
|
||||
insert into sys_dept(
|
||||
dept_id,parent_id,dept_name,ancestors,order_num,leader,phone,email,status,create_by,company_id,create_time,social_credit_code,enterprise_ownership_code)
|
||||
values(
|
||||
#{deptId},#{parentId},#{deptName},#{ancestors},#{orderNum},#{leader},
|
||||
#{phone},#{email},#{status},#{createBy},#{companyId},
|
||||
sysdate(),#{socialCreditCode},#{enterpriseOwnershipCode}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateDept" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
|
||||
update sys_dept
|
||||
|
|
@ -156,6 +165,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="email != null">email = #{email},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="socialCreditCode != null and socialCreditCode != ''">social_credit_code = #{socialCreditCode},</if>
|
||||
<if test="enterpriseOwnershipCode != null and enterpriseOwnershipCode != ''">enterprise_ownership_code = #{enterpriseOwnershipCode},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where dept_id = #{deptId}
|
||||
|
|
@ -199,4 +210,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select max(dept_id)
|
||||
from sys_dept
|
||||
</select>
|
||||
<select id="checkCompanyNameUnique" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from sys_dept
|
||||
where dept_name = #{deptName}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue