fix:车间对象增加负责人id属性。系统部门编码做唯一校验
This commit is contained in:
parent
b4d9add499
commit
04154b7f06
@ -116,8 +116,9 @@ public class SysDeptController extends BaseController
|
||||
{
|
||||
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
String s = autoCodeUtil.genSerialCode("DEPT_CODE", null);
|
||||
dept.setDeptCode(s);
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptCodeUnique(dept))) {
|
||||
return AjaxResult.error("新增部门'" + dept.getDeptCode() + "'失败,部门编码已存在");
|
||||
}
|
||||
dept.setCreateBy(getUsername());
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
@ -132,6 +133,9 @@ public class SysDeptController extends BaseController
|
||||
{
|
||||
Long deptId = dept.getDeptId();
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptCodeUnique(dept))) {
|
||||
return AjaxResult.error("新增部门'" + dept.getDeptCode() + "'失败,部门编码已存在");
|
||||
}
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||
{
|
||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
|
@ -35,6 +35,9 @@ public class MdWorkshop extends BaseEntity
|
||||
@Excel(name = "负责人")
|
||||
private String charge;
|
||||
|
||||
/** 负责人id */
|
||||
private Long chargeId;
|
||||
|
||||
/** 是否启用 */
|
||||
@Excel(name = "是否启用")
|
||||
private String enableFlag;
|
||||
@ -51,7 +54,15 @@ public class MdWorkshop extends BaseEntity
|
||||
/** 预留字段4 */
|
||||
private Long attr4;
|
||||
|
||||
public void setWorkshopId(Long workshopId)
|
||||
public Long getChargeId() {
|
||||
return chargeId;
|
||||
}
|
||||
|
||||
public void setChargeId(Long chargeId) {
|
||||
this.chargeId = chargeId;
|
||||
}
|
||||
|
||||
public void setWorkshopId(Long workshopId)
|
||||
{
|
||||
this.workshopId = workshopId;
|
||||
}
|
||||
@ -150,6 +161,7 @@ public class MdWorkshop extends BaseEntity
|
||||
.append("workshopName", getWorkshopName())
|
||||
.append("area", getArea())
|
||||
.append("charge", getCharge())
|
||||
.append("chargeId", getChargeId())
|
||||
.append("enableFlag", getEnableFlag())
|
||||
.append("remark", getRemark())
|
||||
.append("attr1", getAttr1())
|
||||
|
@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMdWorkshopVo">
|
||||
select workshop_id, workshop_code, workshop_name, area, charge, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_workshop
|
||||
select workshop_id, workshop_code, workshop_name, area, charge, charge_id, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_workshop
|
||||
</sql>
|
||||
|
||||
<select id="selectMdWorkshopList" parameterType="MdWorkshop" resultMap="MdWorkshopResult">
|
||||
|
@ -121,4 +121,11 @@ public interface SysDeptMapper
|
||||
* @return
|
||||
*/
|
||||
List<SysDept> selectAllDeptList();
|
||||
|
||||
/**
|
||||
* 校验部门编码是否唯一
|
||||
* @param deptCode
|
||||
* @return
|
||||
*/
|
||||
SysDept checkDeptCodeUnique(@Param("deptCode") String deptCode);
|
||||
}
|
||||
|
@ -119,4 +119,11 @@ public interface ISysDeptService
|
||||
* @return
|
||||
*/
|
||||
List<SysDept> selectAllDeptList();
|
||||
|
||||
/**
|
||||
* 校验部门编码是否唯一
|
||||
* @param dept
|
||||
* @return
|
||||
*/
|
||||
String checkDeptCodeUnique(SysDept dept);
|
||||
}
|
||||
|
@ -289,6 +289,17 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
return deptMapper.selectAllDeptList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkDeptCodeUnique(SysDept dept) {
|
||||
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
||||
SysDept info = deptMapper.checkDeptCodeUnique(dept.getDeptCode());
|
||||
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
|
@ -88,6 +88,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectAllDeptList" resultType="com.ktg.common.core.domain.entity.SysDept" resultMap="SysDeptResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
</select>
|
||||
<select id="checkDeptCodeUnique" resultType="com.ktg.common.core.domain.entity.SysDept" resultMap="SysDeptResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
where dept_code = #{deptCode}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertDept" parameterType="SysDept">
|
||||
insert into sys_dept(
|
||||
|
Loading…
Reference in New Issue
Block a user