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;
|
||||
@ -21,7 +22,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备Controller
|
||||
*
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2022-05-08
|
||||
*/
|
||||
@ -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, "设备台账");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,19 +13,19 @@ import com.ktg.mes.dv.service.IDvSubjectService;
|
||||
|
||||
/**
|
||||
* 设备点检保养项目Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2022-06-16
|
||||
*/
|
||||
@Service
|
||||
public class DvSubjectServiceImpl implements IDvSubjectService
|
||||
public class DvSubjectServiceImpl implements IDvSubjectService
|
||||
{
|
||||
@Autowired
|
||||
private DvSubjectMapper dvSubjectMapper;
|
||||
|
||||
/**
|
||||
* 查询设备点检保养项目
|
||||
*
|
||||
*
|
||||
* @param subjectId 设备点检保养项目主键
|
||||
* @return 设备点检保养项目
|
||||
*/
|
||||
@ -37,7 +37,7 @@ public class DvSubjectServiceImpl implements IDvSubjectService
|
||||
|
||||
/**
|
||||
* 查询设备点检保养项目列表
|
||||
*
|
||||
*
|
||||
* @param dvSubject 设备点检保养项目
|
||||
* @return 设备点检保养项目
|
||||
*/
|
||||
@ -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;
|
||||
@ -59,7 +59,7 @@ public class DvSubjectServiceImpl implements IDvSubjectService
|
||||
|
||||
/**
|
||||
* 新增设备点检保养项目
|
||||
*
|
||||
*
|
||||
* @param dvSubject 设备点检保养项目
|
||||
* @return 结果
|
||||
*/
|
||||
@ -72,7 +72,7 @@ public class DvSubjectServiceImpl implements IDvSubjectService
|
||||
|
||||
/**
|
||||
* 修改设备点检保养项目
|
||||
*
|
||||
*
|
||||
* @param dvSubject 设备点检保养项目
|
||||
* @return 结果
|
||||
*/
|
||||
@ -85,7 +85,7 @@ public class DvSubjectServiceImpl implements IDvSubjectService
|
||||
|
||||
/**
|
||||
* 批量删除设备点检保养项目
|
||||
*
|
||||
*
|
||||
* @param subjectIds 需要删除的设备点检保养项目主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -97,7 +97,7 @@ public class DvSubjectServiceImpl implements IDvSubjectService
|
||||
|
||||
/**
|
||||
* 删除设备点检保养项目信息
|
||||
*
|
||||
*
|
||||
* @param subjectId 设备点检保养项目主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -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;
|
||||
@ -17,7 +18,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 单位Controller
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-04-27
|
||||
*/
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
@ -6,23 +6,30 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 单位Mapper接口
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-04-27
|
||||
*/
|
||||
public interface MdUnitMeasureMapper
|
||||
public interface MdUnitMeasureMapper
|
||||
{
|
||||
/**
|
||||
* 查询单位
|
||||
*
|
||||
*
|
||||
* @param measureId 单位主键
|
||||
* @return 单位
|
||||
*/
|
||||
public MdUnitMeasure selectMdUnitMeasureByMeasureId(Long measureId);
|
||||
/**
|
||||
* 计量单位唯一校验
|
||||
*
|
||||
* @param mdUnitMeasure 单位主键
|
||||
* @return 单位
|
||||
*/
|
||||
public MdUnitMeasure checkMeasureUnitCodeUnique(MdUnitMeasure mdUnitMeasure);
|
||||
|
||||
/**
|
||||
* 查询单位列表
|
||||
*
|
||||
*
|
||||
* @param mdUnitMeasure 单位
|
||||
* @return 单位集合
|
||||
*/
|
||||
@ -32,7 +39,7 @@ public interface MdUnitMeasureMapper
|
||||
|
||||
/**
|
||||
* 新增单位
|
||||
*
|
||||
*
|
||||
* @param mdUnitMeasure 单位
|
||||
* @return 结果
|
||||
*/
|
||||
@ -40,7 +47,7 @@ public interface MdUnitMeasureMapper
|
||||
|
||||
/**
|
||||
* 修改单位
|
||||
*
|
||||
*
|
||||
* @param mdUnitMeasure 单位
|
||||
* @return 结果
|
||||
*/
|
||||
@ -48,7 +55,7 @@ public interface MdUnitMeasureMapper
|
||||
|
||||
/**
|
||||
* 删除单位
|
||||
*
|
||||
*
|
||||
* @param measureId 单位主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -56,7 +63,7 @@ public interface MdUnitMeasureMapper
|
||||
|
||||
/**
|
||||
* 批量删除单位
|
||||
*
|
||||
*
|
||||
* @param measureIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -6,23 +6,30 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 单位Service接口
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-04-27
|
||||
*/
|
||||
public interface IMdUnitMeasureService
|
||||
public interface IMdUnitMeasureService
|
||||
{
|
||||
/**
|
||||
* 查询单位
|
||||
*
|
||||
*
|
||||
* @param measureId 单位主键
|
||||
* @return 单位
|
||||
*/
|
||||
public MdUnitMeasure selectMdUnitMeasureByMeasureId(Long measureId);
|
||||
/**
|
||||
* 计量单位唯一校验
|
||||
*
|
||||
* @param mdUnitMeasure 单位主键
|
||||
* @return 单位
|
||||
*/
|
||||
public String checkMeasureUnitCodeUnique(MdUnitMeasure mdUnitMeasure);
|
||||
|
||||
/**
|
||||
* 查询单位列表
|
||||
*
|
||||
*
|
||||
* @param mdUnitMeasure 单位
|
||||
* @return 单位集合
|
||||
*/
|
||||
@ -37,7 +44,7 @@ public interface IMdUnitMeasureService
|
||||
|
||||
/**
|
||||
* 新增单位
|
||||
*
|
||||
*
|
||||
* @param mdUnitMeasure 单位
|
||||
* @return 结果
|
||||
*/
|
||||
@ -45,7 +52,7 @@ public interface IMdUnitMeasureService
|
||||
|
||||
/**
|
||||
* 修改单位
|
||||
*
|
||||
*
|
||||
* @param mdUnitMeasure 单位
|
||||
* @return 结果
|
||||
*/
|
||||
@ -53,7 +60,7 @@ public interface IMdUnitMeasureService
|
||||
|
||||
/**
|
||||
* 批量删除单位
|
||||
*
|
||||
*
|
||||
* @param measureIds 需要删除的单位主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@ -61,7 +68,7 @@ public interface IMdUnitMeasureService
|
||||
|
||||
/**
|
||||
* 删除单位信息
|
||||
*
|
||||
*
|
||||
* @param measureId 单位主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -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;
|
||||
@ -11,7 +14,7 @@ import com.ktg.mes.md.domain.MdUnitMeasure;
|
||||
|
||||
/**
|
||||
* 单位Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-04-27
|
||||
*/
|
||||
@ -23,7 +26,7 @@ public class MdUnitMeasureServiceImpl implements IMdUnitMeasureService
|
||||
|
||||
/**
|
||||
* 查询单位
|
||||
*
|
||||
*
|
||||
* @param measureId 单位主键
|
||||
* @return 单位
|
||||
*/
|
||||
@ -33,9 +36,19 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单位列表
|
||||
*
|
||||
*
|
||||
* @param mdUnitMeasure 单位
|
||||
* @return 单位
|
||||
*/
|
||||
@ -52,7 +65,7 @@ public class MdUnitMeasureServiceImpl implements IMdUnitMeasureService
|
||||
|
||||
/**
|
||||
* 新增单位
|
||||
*
|
||||
*
|
||||
* @param mdUnitMeasure 单位
|
||||
* @return 结果
|
||||
*/
|
||||
@ -65,7 +78,7 @@ public class MdUnitMeasureServiceImpl implements IMdUnitMeasureService
|
||||
|
||||
/**
|
||||
* 修改单位
|
||||
*
|
||||
*
|
||||
* @param mdUnitMeasure 单位
|
||||
* @return 结果
|
||||
*/
|
||||
@ -78,7 +91,7 @@ public class MdUnitMeasureServiceImpl implements IMdUnitMeasureService
|
||||
|
||||
/**
|
||||
* 批量删除单位
|
||||
*
|
||||
*
|
||||
* @param measureIds 需要删除的单位主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -90,7 +103,7 @@ public class MdUnitMeasureServiceImpl implements IMdUnitMeasureService
|
||||
|
||||
/**
|
||||
* 删除单位信息
|
||||
*
|
||||
*
|
||||
* @param measureId 单位主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ktg.mes.md.mapper.MdUnitMeasureMapper">
|
||||
|
||||
|
||||
<resultMap type="MdUnitMeasure" id="MdUnitMeasureResult">
|
||||
<result property="measureId" column="measure_id" />
|
||||
<result property="measureCode" column="measure_code" />
|
||||
@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectMdUnitMeasureList" parameterType="MdUnitMeasure" resultMap="MdUnitMeasureResult">
|
||||
<include refid="selectMdUnitMeasureVo"/>
|
||||
<where>
|
||||
<where>
|
||||
<if test="measureCode != null and measureCode != ''"> and measure_code = #{measureCode}</if>
|
||||
<if test="measureName != null and measureName != ''"> and measure_name like concat('%', #{measureName}, '%')</if>
|
||||
<if test="primaryFlag != null and primaryFlag != ''"> and primary_flag = #{primaryFlag}</if>
|
||||
@ -42,7 +42,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="attr4 != null "> and attr4 = #{attr4}</if>
|
||||
</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}
|
||||
@ -118,9 +123,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMdUnitMeasureByMeasureIds" parameterType="String">
|
||||
delete from md_unit_measure where measure_id in
|
||||
delete from md_unit_measure where measure_id in
|
||||
<foreach item="measureId" collection="array" open="(" separator="," close=")">
|
||||
#{measureId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
@ -21,12 +21,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectDeptVo">
|
||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
|
||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
|
||||
from sys_dept d
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
where d.del_flag = '0'
|
||||
@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
${params.dataScope}
|
||||
order by d.parent_id, d.order_num
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectDeptListByRoleId" resultType="Long">
|
||||
select d.dept_id
|
||||
from sys_dept d
|
||||
@ -57,34 +57,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
order by d.parent_id, d.order_num
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
where dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
||||
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
|
||||
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
|
||||
select count(1) from sys_dept
|
||||
where del_flag = '0' and parent_id = #{deptId} limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
|
||||
select * from sys_dept where find_in_set(#{deptId}, ancestors)
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
|
||||
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
|
||||
</select>
|
||||
|
||||
|
||||
<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">
|
||||
insert into sys_dept(
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateDept" parameterType="SysDept">
|
||||
update sys_dept
|
||||
<set>
|
||||
@ -129,7 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</set>
|
||||
where dept_id = #{deptId}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateDeptChildren" parameterType="java.util.List">
|
||||
update sys_dept set ancestors =
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
@ -142,16 +142,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item.deptId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateDeptStatusNormal" parameterType="Long">
|
||||
update sys_dept set status = '0' where dept_id in
|
||||
update sys_dept set status = '0' where dept_id in
|
||||
<foreach collection="array" item="deptId" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteDeptById" parameterType="Long">
|
||||
update sys_dept set del_flag = '2' where dept_id = #{deptId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
@ -16,12 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectPostVo">
|
||||
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
|
||||
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
|
||||
from sys_post
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
|
||||
<include refid="selectPostVo"/>
|
||||
<where>
|
||||
@ -35,17 +35,18 @@ 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">
|
||||
<include refid="selectPostVo"/>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
|
||||
<include refid="selectPostVo"/>
|
||||
where post_id = #{postId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
|
||||
select p.post_id
|
||||
from sys_post p
|
||||
@ -53,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join sys_user u on u.user_id = up.user_id
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
|
||||
select p.post_id, p.post_name, p.post_code
|
||||
from sys_post p
|
||||
@ -61,17 +62,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join sys_user u on u.user_id = up.user_id
|
||||
where u.user_name = #{userName}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
|
||||
<include refid="selectPostVo"/>
|
||||
where post_name=#{postName} limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
|
||||
<include refid="selectPostVo"/>
|
||||
where post_code=#{postCode} limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updatePost" parameterType="SysPost">
|
||||
update sys_post
|
||||
<set>
|
||||
@ -85,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</set>
|
||||
where post_id = #{postId}
|
||||
</update>
|
||||
|
||||
|
||||
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
|
||||
insert into sys_post(
|
||||
<if test="postId != null and postId != 0">post_id,</if>
|
||||
@ -107,16 +108,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<delete id="deletePostById" parameterType="Long">
|
||||
delete from sys_post where post_id = #{postId}
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deletePostByIds" parameterType="Long">
|
||||
delete from sys_post where post_id in
|
||||
<foreach collection="array" item="postId" open="(" separator="," close=")">
|
||||
#{postId}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
@ -20,16 +20,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectRoleVo">
|
||||
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
|
||||
r.status, r.del_flag, r.create_time, r.remark
|
||||
r.status, r.del_flag, r.create_time, r.remark
|
||||
from sys_role r
|
||||
left join sys_user_role ur on ur.role_id = r.role_id
|
||||
left join sys_user u on u.user_id = ur.user_id
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.del_flag = '0'
|
||||
@ -55,16 +55,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
${params.dataScope}
|
||||
order by r.role_sort
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
WHERE r.del_flag = '0' and ur.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRoleAll" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
|
||||
select r.role_id
|
||||
from sys_role r
|
||||
@ -72,27 +72,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join sys_user u on u.user_id = ur.user_id
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
WHERE r.del_flag = '0' and u.user_name = #{userName}
|
||||
</select>
|
||||
|
||||
|
||||
<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">
|
||||
insert into sys_role(
|
||||
<if test="roleId != null and roleId != 0">role_id,</if>
|
||||
@ -120,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateRole" parameterType="SysRole">
|
||||
update sys_role
|
||||
<set>
|
||||
@ -137,16 +137,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</set>
|
||||
where role_id = #{roleId}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteRoleById" parameterType="Long">
|
||||
update sys_role set del_flag = '2' where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deleteRoleByIds" parameterType="Long">
|
||||
update sys_role set del_flag = '2' where role_id in
|
||||
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
</mapper>
|
||||
|
@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<resultMap id="deptResult" type="SysDept">
|
||||
<id property="deptId" column="dept_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="leader" column="leader" />
|
||||
<result property="status" column="dept_status" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<resultMap id="RoleResult" type="SysRole">
|
||||
<id property="roleId" column="role_id" />
|
||||
<result property="roleName" column="role_name" />
|
||||
@ -44,9 +44,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="dataScope" column="data_scope" />
|
||||
<result property="status" column="role_status" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||
from sys_user u
|
||||
@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
@ -83,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
from sys_user u
|
||||
@ -100,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
from sys_user u
|
||||
@ -118,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName}
|
||||
@ -128,23 +128,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectUserVo"/>
|
||||
where u.phonenumber = #{phonenumber}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_id = #{userId}
|
||||
</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">
|
||||
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<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>
|
||||
@ -180,7 +181,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateUser" parameterType="SysUser">
|
||||
update sys_user
|
||||
<set>
|
||||
@ -201,28 +202,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateUserStatus" parameterType="SysUser">
|
||||
update sys_user set status = #{status} where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateUserAvatar" parameterType="SysUser">
|
||||
update sys_user set avatar = #{avatar} where user_name = #{userName}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="resetUserPwd" parameterType="SysUser">
|
||||
update sys_user set password = #{password} where user_name = #{userName}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
update sys_user set del_flag = '2' where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deleteUserByIds" parameterType="Long">
|
||||
update sys_user set del_flag = '2' where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user