feat:功能优化
This commit is contained in:
parent
1b4bc5725c
commit
0d65839d27
3
.gitignore
vendored
3
.gitignore
vendored
@ -47,3 +47,6 @@ nbdist/
|
||||
!*/build/*.xml
|
||||
application-druid.yml
|
||||
application-pro.yml
|
||||
#忽略所有target目录
|
||||
target/
|
||||
.vscode
|
||||
|
@ -4,6 +4,7 @@ import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.domain.entity.SysUser;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.SecurityUtils;
|
||||
@ -117,4 +118,11 @@ public class DvMachineryController extends BaseController
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response)
|
||||
{
|
||||
ExcelUtil<DvMachinery> util = new ExcelUtil<DvMachinery>(DvMachinery.class);
|
||||
util.importTemplateExcel(response, "设备台账");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class DvSubjectServiceImpl implements IDvSubjectService
|
||||
public String checkSubjectCodeUnique(DvSubject dvSubject) {
|
||||
DvSubject subject = dvSubjectMapper.checkSubjectCodeUnique(dvSubject);
|
||||
Long subjectId = dvSubject.getSubjectId()==null?-1L:dvSubject.getSubjectId();
|
||||
if(StringUtils.isNotNull(subject) && subject.getSubjectId().longValue() == subjectId.longValue()){
|
||||
if(StringUtils.isNotNull(subject) && subject.getSubjectId().longValue() != subjectId.longValue()){
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.ktg.mes.md.controller;
|
||||
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.mes.md.service.IMdUnitMeasureService;
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
@ -86,6 +87,9 @@ public class MdUnitMeasureController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MdUnitMeasure mdUnitMeasure)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(mdUnitMeasureService.checkMeasureUnitCodeUnique(mdUnitMeasure))){
|
||||
return AjaxResult.error("单位编码已存在!");
|
||||
}
|
||||
return toAjax(mdUnitMeasureService.insertMdUnitMeasure(mdUnitMeasure));
|
||||
}
|
||||
|
||||
@ -97,6 +101,9 @@ public class MdUnitMeasureController extends BaseController
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MdUnitMeasure mdUnitMeasure)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(mdUnitMeasureService.checkMeasureUnitCodeUnique(mdUnitMeasure))){
|
||||
return AjaxResult.error("单位编码已存在!");
|
||||
}
|
||||
return toAjax(mdUnitMeasureService.updateMdUnitMeasure(mdUnitMeasure));
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,13 @@ public interface MdUnitMeasureMapper
|
||||
* @return 单位
|
||||
*/
|
||||
public MdUnitMeasure selectMdUnitMeasureByMeasureId(Long measureId);
|
||||
/**
|
||||
* 计量单位唯一校验
|
||||
*
|
||||
* @param mdUnitMeasure 单位主键
|
||||
* @return 单位
|
||||
*/
|
||||
public MdUnitMeasure checkMeasureUnitCodeUnique(MdUnitMeasure mdUnitMeasure);
|
||||
|
||||
/**
|
||||
* 查询单位列表
|
||||
|
@ -19,6 +19,13 @@ public interface IMdUnitMeasureService
|
||||
* @return 单位
|
||||
*/
|
||||
public MdUnitMeasure selectMdUnitMeasureByMeasureId(Long measureId);
|
||||
/**
|
||||
* 计量单位唯一校验
|
||||
*
|
||||
* @param mdUnitMeasure 单位主键
|
||||
* @return 单位
|
||||
*/
|
||||
public String checkMeasureUnitCodeUnique(MdUnitMeasure mdUnitMeasure);
|
||||
|
||||
/**
|
||||
* 查询单位列表
|
||||
|
@ -2,6 +2,9 @@ package com.ktg.mes.md.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.mes.md.domain.MdClient;
|
||||
import com.ktg.mes.md.service.IMdUnitMeasureService;
|
||||
import com.ktg.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -33,6 +36,16 @@ public class MdUnitMeasureServiceImpl implements IMdUnitMeasureService
|
||||
return mdUnitMeasureMapper.selectMdUnitMeasureByMeasureId(measureId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkMeasureUnitCodeUnique(MdUnitMeasure mdUnitMeasure) {
|
||||
MdUnitMeasure unitMeasure = mdUnitMeasureMapper.checkMeasureUnitCodeUnique(mdUnitMeasure);
|
||||
Long subjectId = mdUnitMeasure.getMeasureId()==null?-1L:mdUnitMeasure.getMeasureId();
|
||||
if(StringUtils.isNotNull(unitMeasure)&& unitMeasure.getMeasureId().longValue() != subjectId.longValue()){
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单位列表
|
||||
*
|
||||
|
@ -43,6 +43,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="checkMeasureUnitCodeUnique" parameterType="MdUnitMeasure" resultMap="MdUnitMeasureResult">
|
||||
<include refid="selectMdUnitMeasureVo"/>
|
||||
where measure_code = #{measureCode} limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectMdUnitMeasureByMeasureId" parameterType="Long" resultMap="MdUnitMeasureResult">
|
||||
<include refid="selectMdUnitMeasureVo"/>
|
||||
where measure_id = #{measureId}
|
||||
|
@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
where dept_name=#{deptName} and parent_id = #{parentId} limit 1
|
||||
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertDept" parameterType="SysDept">
|
||||
|
@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND post_name like concat('%', #{postName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
order by post_sort asc
|
||||
</select>
|
||||
|
||||
<select id="selectPostAll" resultMap="SysPostResult">
|
||||
|
@ -85,12 +85,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.role_name=#{roleName} limit 1
|
||||
where r.role_name=#{roleName} and r.del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.role_key=#{roleKey} limit 1
|
||||
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
|
||||
|
@ -135,7 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="checkUserNameUnique" parameterType="String" resultType="int">
|
||||
select count(1) from sys_user where user_name = #{userName} limit 1
|
||||
select count(1) from sys_user where user_name = #{userName} and del_flag='0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||
@ -145,6 +145,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, email from sys_user where email = #{email} limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkUserNickNameUnique" resultType="java.lang.Integer">
|
||||
select count(1) from sys_user where nick_name = #{nickName} limit 1
|
||||
</select>
|
||||
|
Loading…
Reference in New Issue
Block a user