提交修改

This commit is contained in:
quyixiao 2020-08-13 17:31:16 +08:00
parent 0cd1b5fd45
commit 69b9913e60
19 changed files with 508 additions and 77 deletions

View File

@ -241,6 +241,12 @@
<version>1.7</version>
</dependency>
<dependency>
<artifactId>taobao-sdk-java-auto_1479188381469</artifactId>
<groupId>dingtalk</groupId>
<version>20200811</version>
</dependency>

View File

@ -1,27 +1,37 @@
package com.lz.modules.app.controller;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.lz.common.utils.NumberUtil;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.modules.app.dto.DepartmentsDto;
import com.lz.modules.app.dto.StaffDepartmentDto;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.resp.ResultDetailResp;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.sys.entity.app.ResultDetail;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultDetailService;
import com.lz.modules.sys.service.app.ResultRecordService;
import io.jsonwebtoken.lang.Collections;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -39,23 +49,127 @@ public class ResultRecordController {
@Autowired
private DepartmentsService departmentsService;
@Autowired
private ResultDetailService resultDetailService;
@Autowired
private ResultRecordService resultRecordService;
@Autowired
private StaffService staffService;
@Autowired
private DepartmentsStaffRelateService departmentsStaffRelateService;
/**
* 列表
*/
@RequestMapping("/list")
@RequiresPermissions("user:lzresultrecord:list")
public R list(ResultRecordReq req){
public R list(ResultRecordReq req) {
PageUtils page = lzResultRecordService.queryPage(req);
List<DepartmentsDto> departmentList1 = departmentsService.selectByParentDepartmentId("0");
return R.ok().put("page", page)
.put("departmentList1",departmentList1);
.put("departmentList1", departmentList1);
}
@RequestMapping("/departmentQuery")
public R departmentQuery(ResultRecordReq req){
public R departmentQuery(ResultRecordReq req) {
List<DepartmentsDto> departmentList1 = departmentsService.selectByParentDepartmentId(req.getDepartmentId());
return R.ok()
.put("departmentList",departmentList1);
.put("departmentList", departmentList1);
}
@RequestMapping("/getStaffResultDetail")
public R getStaffResultDetail(ResultRecordReq req) {
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
StaffEntity staffEntity = staffService.getById(resultRecord.getStaffId());
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateService.selectByStaffIds(Arrays.asList(staffEntity.getId()));
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateEntities.get(0);
StaffDepartmentDto departmentDto = departmentsService.selectStaffAllDepartments(departmentsStaffRelateEntity.getDepartmentId());
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(req.getRecordResultId());
SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy年MM月dd");
List<ResultDetailResp> list = new ArrayList<>();
int firstRowspan = 0;
int secondRowspan = 0;
int threeRowspan = 0;
int fourRowspan = 0;
int fiveRowspan = 0;
if (!Collections.isEmpty(resultDetails)) {
Map<Integer, Long> details = resultDetails.stream().collect(Collectors.groupingBy(ResultDetail::getType, Collectors.counting()));
int type1 = NumberUtil.objToIntDefault(details.get(new Integer(1)), 0);
int type2 = NumberUtil.objToIntDefault(details.get(new Integer(2)), 0);
firstRowspan = type1;
secondRowspan = type1 + 1;
threeRowspan = type1 + 1 + type2;
fourRowspan = type1 + 1 + type2 + 1;
fiveRowspan = type1 + 1 + type2 + 2;
int count = 0;
for (ResultDetail resultDetail : resultDetails) {
count++;
ResultDetailResp resp = new ResultDetailResp();
BeanUtils.copyProperties(resultDetail, resp);
if (resultDetail.getType() == 1) {
resp.setCheckRange("业绩");
} else if (resultDetail.getType() == 2) {
resp.setCheckRange("文化价值观");
}
if(count == type1 || count == type1 + type2){
resp.setIsAdd(1);
}
if (count == type1 + 1) {
ResultDetailResp respHeader = new ResultDetailResp();
respHeader.setKeyResult("业务考核结果");
respHeader.setCheckWeight(new BigDecimal(0.7));
respHeader.setSuperScore("/");
respHeader.setAcquireScore(new BigDecimal(0));
respHeader.setScoreComment("/");
respHeader.setIsAdd(-1);
list.add(respHeader);
}
list.add(resp);
}
}
ResultDetailResp tail1 = new ResultDetailResp();
tail1.setKeyResult("文化价值观考核结果");
tail1.setCheckWeight(new BigDecimal(0.3));
tail1.setSuperScore("/");
tail1.setAcquireScore(new BigDecimal(0));
tail1.setScoreComment("/");
tail1.setIsAdd(-1);
ResultDetailResp tail2 = new ResultDetailResp();
tail2.setCheckRange("文化价值观考核结果");
tail2.setAcquireScore(new BigDecimal(0));
tail2.setScoreComment("/");
tail2.setIsAdd(-1);
ResultDetailResp tail3 = new ResultDetailResp();
tail3.setCheckRange("最终绩效考核结果等级");
tail3.setAcquireScore(new BigDecimal(3.25));
tail3.setScoreComment("/");
tail3.setIsAdd(-1);
list.add(tail1);
list.add(tail2);
list.add(tail3);
return R.ok()
.put("staffName", staffEntity.getName())
.put("department1", departmentDto.getDepartment1())
.put("department2", departmentDto.getDepartment2())
.put("department3", departmentDto.getDepartment3())
.put("checkMonth", sdf3.format(resultRecord.getGmtCreate()))
.put("firstRowspan", firstRowspan)
.put("secondRowspan", secondRowspan)
.put("threeRowspan", threeRowspan)
.put("fourRowspan", fourRowspan)
.put("fiveRowspan", fiveRowspan)
.put("list", list);
}
/**
@ -63,8 +177,8 @@ public class ResultRecordController {
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("user:lzresultrecord:info")
public R info(@PathVariable("id") Long id){
ResultRecord lzResultRecord = lzResultRecordService.selectResultRecordById(id);
public R info(@PathVariable("id") Long id) {
ResultRecord lzResultRecord = lzResultRecordService.selectResultRecordById(id);
return R.ok().put("lzResultRecord", lzResultRecord);
}
@ -74,8 +188,8 @@ public class ResultRecordController {
*/
@RequestMapping("/save")
@RequiresPermissions("user:lzresultrecord:save")
public R save(@RequestBody ResultRecord lzResultRecord){
lzResultRecordService.insertResultRecord(lzResultRecord);
public R save(@RequestBody ResultRecord lzResultRecord) {
lzResultRecordService.insertResultRecord(lzResultRecord);
return R.ok();
}
@ -85,8 +199,8 @@ public class ResultRecordController {
*/
@RequestMapping("/update")
@RequiresPermissions("user:lzresultrecord:update")
public R update(@RequestBody ResultRecord lzResultRecord){
lzResultRecordService.updateResultRecordById(lzResultRecord);
public R update(@RequestBody ResultRecord lzResultRecord) {
lzResultRecordService.updateResultRecordById(lzResultRecord);
return R.ok();
}
@ -96,8 +210,8 @@ public class ResultRecordController {
*/
@RequestMapping("/delete")
@RequiresPermissions("user:lzresultrecord:delete")
public R delete(@RequestBody Long[] ids){
lzResultRecordService.deleteBatchIds(Arrays.asList(ids));
public R delete(@RequestBody Long[] ids) {
lzResultRecordService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}

View File

@ -1,6 +1,7 @@
package com.lz.modules.app.dao;
import com.lz.modules.app.dto.DepartmentsDto;
import com.lz.modules.app.dto.StaffDepartmentDto;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@ -34,4 +35,6 @@ public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {
List<DepartmentsEntity> selectEntityByParentDepartmentId(@Param("parentId") String parentId);
DepartmentsEntity selectByDepartmentId(@Param("departmentId") String departmentId);
StaffDepartmentDto selectStaffAllDepartments(@Param("departmentId") String departmentId);
}

View File

@ -0,0 +1,11 @@
package com.lz.modules.app.dto;
import lombok.Data;
@Data
public class StaffDepartmentDto {
private String department1;
private String department2;
private String department3;
private String department4;
}

View File

@ -24,5 +24,8 @@ public class ResultRecordReq {
private List<Long> departmentStaffIds;
private List<Long> staffIds;
private Long recordResultId;
}

View File

@ -0,0 +1,44 @@
package com.lz.modules.app.resp;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class ResultDetailResp {
private Long id;
//是否删除状态1删除0有效
private Integer isDelete;
//创建时间
private Date gmtCreate;
//最后修改时间
private Date gmtModified;
//1业绩2文化价值观
private Integer type;
//考核维度
private String checkRange;
//目标
private String target;
//关键结果
private String keyResult;
//考核权重
private BigDecimal checkWeight;
//考核结果
private String checkResult;
//直属上级评分
private String superScore;
//得分
private BigDecimal acquireScore;
//评分说明
private String scoreComment;
//记录id
private Long recordId;
//用户id
private Long staffId;
//优先级从大到小
private Integer priority;
private int isAdd;
}

View File

@ -3,6 +3,7 @@ package com.lz.modules.app.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.PageUtils;
import com.lz.modules.app.dto.DepartmentsDto;
import com.lz.modules.app.dto.StaffDepartmentDto;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
@ -31,5 +32,7 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
List<DepartmentsEntity> selectEntityByParentDepartmentId(String parentId);
DepartmentsEntity selectByDepartmentId(String departmentId);
StaffDepartmentDto selectStaffAllDepartments(String departmentId);
}

View File

@ -28,5 +28,7 @@ public interface DepartmentsStaffRelateService extends IService<DepartmentsStaff
List<DepartmentsStaffRelateEntity> selectAll();
List<DepartmentsStaffRelateEntity> selectByStaffIds(List<Long> staffIds);
}

View File

@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.Query;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dto.DepartmentsDto;
import com.lz.modules.app.dao.DepartmentsDao;
import com.lz.modules.app.dto.StaffDepartmentDto;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
@ -73,6 +75,17 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
return departmentsDao.selectByDepartmentId(departmentId);
}
@Override
public StaffDepartmentDto selectStaffAllDepartments(String departmentId) {
StaffDepartmentDto staffDepartmentDto = departmentsDao.selectStaffAllDepartments(departmentId);
if(StringUtil.isEmpty(staffDepartmentDto.getDepartment1())){
staffDepartmentDto.setDepartment1(staffDepartmentDto.getDepartment2());
staffDepartmentDto.setDepartment2(staffDepartmentDto.getDepartment3());
staffDepartmentDto.setDepartment3(staffDepartmentDto.getDepartment4());
}
return staffDepartmentDto;
}
private List<DepartmentsDto> getDepartmentTreeList(List<DepartmentsDto> departmentList) {
List<DepartmentsDto> DepartmentsList = Lists.newArrayList();
for (DepartmentsDto departmentsDto : departmentList) {

View File

@ -63,5 +63,10 @@ public class DepartmentsStaffRelateServiceImpl extends ServiceImpl<DepartmentsSt
return departmentsStaffRelateDao.selectAll();
}
@Override
public List<DepartmentsStaffRelateEntity> selectByStaffIds(List<Long> staffIds) {
return departmentsStaffRelateDao.selectByStaffIds(staffIds);
}
}

View File

@ -0,0 +1,123 @@
package com.lz.modules.job.business;
import com.google.common.collect.Lists;
import com.lz.common.utils.DateUtils;
import com.lz.common.utils.FeishuUtil;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.entity.StaffOccupationEntity;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffOccupationService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
/**
* @author fumeiai
* @date 2019-05-29 17:06
* @Description 钉钉业务
* @注意 本内容仅限于杭州霖梓网络科技有限公司内部传阅禁止外泄以及用于其他的商业目的
*/
@Component(value = "dingtalkBusiness")
public class DingtalkBusiness {
protected final static org.slf4j.Logger logger = LoggerFactory.getLogger(DingtalkBusiness.class);
@Autowired
FeishuUtil feishuUtil;
@Resource
DepartmentsService departmentsService;
@Resource
DepartmentsStaffRelateService departmentsStaffRelateService;
@Resource
StaffService staffService;
@Resource
StaffOccupationService staffOccupationService;
/**
* 获取组织架构信息并录入到数据库
*/
// @DataSource(name = DataSourceNames.FOUR)
public void getFeishuDepartmentsIntoData() {
//获取Token
String token = feishuUtil.getAccessToken();
//获取通讯录授权范围获取最高级架构的department_id
List<String> departmentIds = feishuUtil.getDepartmentIds(token);
if (departmentIds == null || departmentIds.size() == 0) {
return;
}
//批量获取部门详情根据详情填充部门信息
StringBuffer departmentIdSbs = new StringBuffer();
for (String departmentId : departmentIds) {
//获取子孙部门id列表
departmentIdSbs.append("department_ids=" + departmentId + "&");
List<String> childDepartmentIds = feishuUtil.getChildDepartmentIds(token, departmentId);
for (String childDepartmentId : childDepartmentIds) {
departmentIdSbs.append("department_ids=" + childDepartmentId + "&");
}
}
String topDepartmentIds = departmentIdSbs.toString().substring(0, departmentIdSbs.toString().length() - 1);
//获取所有的部门详情
List<DepartmentInfosBo> departmentInfosBos = feishuUtil.getDepartmentDetails(token, topDepartmentIds);
//更新数据库中的部门相关信息
departmentsService.updateDepartmentInfos(departmentInfosBos);
departmentsStaffRelateService.deleteAllRelates();
//未在飞书组织架构里的成员置为离职(全部置为离职再把在职的恢复)
staffOccupationService.updateAllOccupation();
//获取飞书部门对应的用户详情
for (DepartmentInfosBo departmentInfo : departmentInfosBos) {
//获取部门用户详情
List<DepartmentStaffBo> staffs = feishuUtil.getDepartmentStaffDetails(token, departmentInfo.getId());
logger.info("=============================" + departmentInfo.getName() + "================================");
// for (DepartmentStaffBo staff : staffs)
// logger.info(staff.getName());
//循环录入到员工信息表中
List<Long> staffIds = staffService.updateStaffsInfo(staffs);
//加入到部门和员工关系表
departmentsStaffRelateService.addRelateInfos(departmentInfo.getId(), staffIds);
//录入员工职业信息表
enterStaffOccupationInfos(staffs);
}
}
public void enterStaffOccupationInfos(List<DepartmentStaffBo> staffs) {
List<StaffOccupationEntity> StaffOccupations = Lists.newArrayList();
for (DepartmentStaffBo departmentStaffBo : staffs) {
StaffEntity staffEntity = staffService.getStaffInfoByOpenId(departmentStaffBo.getOpenId());
Long staffId = staffEntity.getId();
StaffOccupationEntity staffOccupationEntity = staffOccupationService.getStaffOccupationByStaffId(staffId);
if (staffOccupationEntity == null) {
StaffOccupationEntity staffOccupation = new StaffOccupationEntity();
staffOccupation.setStaffId(staffId);
staffOccupation.setEmployeeNo(departmentStaffBo.getEmployeeNo());
staffOccupation.setStaffType(departmentStaffBo.getEmployeeType());
staffOccupation.setStaffStatus(departmentStaffBo.getStatus());
staffOccupation.setEntryTime(DateUtils.getCurrentDate());
StaffOccupations.add(staffOccupation);
} else {
staffOccupationService.updateStatusByStaffId(staffId, departmentStaffBo.getStatus());
}
}
if (StaffOccupations.size() > 0) {
staffOccupationService.saveBatch(StaffOccupations);
}
}
}

View File

@ -0,0 +1,42 @@
/**
* Copyright (c) 2020 fumeiai All rights reserved.
*
*
*
* 版权所有侵权必究
*/
package com.lz.modules.job.task;
import com.lz.common.utils.DateUtils;
import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.job.business.FeishuBusiness;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 获取飞钉钉组织架构信息定时任务
*
* getFeishuDepartmentsJob为spring bean的名称
*
* @author fumeiai 20200429
*/
@Component("dingtalkSynDataJob")
public class DingtalkSynDataJob implements ITask {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
DingtalkBusiness dingtalkBusiness;
@Override
public void run(String params) {
logger.info("dingtalkSynDataJob start date == {}", DateUtils.getCurrentDate());
dingtalkBusiness.getFeishuDepartmentsIntoData();
logger.info("dingtalkSynDataJob end date == {}", DateUtils.getCurrentDate());
}
}

View File

@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.sys.entity.app.ResultDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ResultDetailMapper extends BaseMapper<ResultDetail> {
@ -30,4 +33,5 @@ public interface ResultDetailMapper extends BaseMapper<ResultDetail> {
int deleteResultDetailById(@Param("id") Long id);
List<ResultDetail> selectByRecordId(@Param("recordResultId") Long recordResultId);
}

View File

@ -11,7 +11,7 @@ import java.util.Date;
* 菜单权限表
* </p>*业绩详情表
* @author quyixiao
* @since 2020-08-10
* @since 2020-08-13
*/
@Data
@ -28,24 +28,35 @@ public class ResultDetail implements java.io.Serializable {
private Date gmtModified;
//1业绩2文化价值观
private Integer type;
//
//目标
private String target;
//
//关键结果
private String keyResult;
//考核权重
private BigDecimal checkWeight;
//考核结果
private String checkResult;
//直属上级评分
private BigDecimal superScore;
//
private String superScore;
//得分
private BigDecimal acquireScore;
//评分说明
private String scoreComment;
//记录id
private Long recordId;
//用户id
private Long userId;
private Long staffId;
//优先级从大到小
private Integer priority;
public ResultDetail() {
}
public ResultDetail(Integer type) {
this.type = type;
}
/**
*
* @return
@ -122,14 +133,14 @@ public class ResultDetail implements java.io.Serializable {
}
/**
*
* 目标
* @return
*/
public String getTarget() {
return target;
}
/**
*
* 目标
* @param target
*/
public void setTarget(String target) {
@ -137,14 +148,14 @@ public class ResultDetail implements java.io.Serializable {
}
/**
*
* 关键结果
* @return
*/
public String getKeyResult() {
return keyResult;
}
/**
*
* 关键结果
* @param keyResult
*/
public void setKeyResult(String keyResult) {
@ -185,26 +196,26 @@ public class ResultDetail implements java.io.Serializable {
* 直属上级评分
* @return
*/
public BigDecimal getSuperScore() {
public String getSuperScore() {
return superScore;
}
/**
* 直属上级评分
* @param superScore
*/
public void setSuperScore(BigDecimal superScore) {
public void setSuperScore(String superScore) {
this.superScore = superScore;
}
/**
*
* 得分
* @return
*/
public BigDecimal getAcquireScore() {
return acquireScore;
}
/**
*
* 得分
* @param acquireScore
*/
public void setAcquireScore(BigDecimal acquireScore) {
@ -245,15 +256,30 @@ public class ResultDetail implements java.io.Serializable {
* 用户id
* @return
*/
public Long getUserId() {
return userId;
public Long getStaffId() {
return staffId;
}
/**
* 用户id
* @param userId
* @param staffId
*/
public void setUserId(Long userId) {
this.userId = userId;
public void setStaffId(Long staffId) {
this.staffId = staffId;
}
/**
* 优先级从大到小
* @return
*/
public Integer getPriority() {
return priority;
}
/**
* 优先级从大到小
* @param priority
*/
public void setPriority(Integer priority) {
this.priority = priority;
}
@Override
@ -272,7 +298,8 @@ public class ResultDetail implements java.io.Serializable {
",acquireScore=" + acquireScore +
",scoreComment=" + scoreComment +
",recordId=" + recordId +
",userId=" + userId +
",staffId=" + staffId +
",priority=" + priority +
"}";
}
}

View File

@ -3,6 +3,8 @@ package com.lz.modules.sys.service.app;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.modules.sys.entity.app.ResultDetail;
import java.util.List;
/**
* <p>
* 业绩详情表 服务类
@ -30,4 +32,5 @@ public interface ResultDetailService extends IService<ResultDetail> {
int deleteResultDetailById(Long id);
List<ResultDetail> selectByRecordId(Long recordResultId);
}

View File

@ -7,6 +7,8 @@ import com.lz.modules.sys.service.app.ResultDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 业绩详情表 服务类
@ -59,5 +61,10 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
}
@Override
public List<ResultDetail> selectByRecordId(Long recordResultId) {
return resultDetailMapper.selectByRecordId(recordResultId);
}
}

View File

@ -17,59 +17,62 @@
<result column="acquire_score" property="acquireScore"/>
<result column="score_comment" property="scoreComment"/>
<result column="record_id" property="recordId"/>
<result column="user_id" property="userId"/>
<result column="staff_id" property="staffId"/>
<result column="priority" property="priority"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, type AS type, target AS target, key_result AS keyResult, check_weight AS checkWeight, check_result AS checkResult, super_score AS superScore, acquire_score AS acquireScore, score_comment AS scoreComment, record_id AS recordId, user_id AS userId
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, type AS type, target AS target, key_result AS keyResult, check_weight AS checkWeight, check_result AS checkResult, super_score AS superScore, acquire_score AS acquireScore, score_comment AS scoreComment, record_id AS recordId, staff_id AS staffId, priority AS priority
</sql>
<select id="selectResultDetailById" resultType="ResultDetail" >
select * from lz_result_detail where id=#{id} and is_delete = 0 limit 1
select * from lz_result_detail where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertResultDetail" parameterType="ResultDetail" useGeneratedKeys="true" keyProperty="id" >
insert into lz_result_detail(
<if test="type != null">type, </if>
<if test="target != null">target, </if>
<if test="keyResult != null">key_result, </if>
<if test="checkWeight != null">check_weight, </if>
<if test="checkResult != null">check_result, </if>
<if test="superScore != null">super_score, </if>
<if test="acquireScore != null">acquire_score, </if>
<if test="scoreComment != null">score_comment, </if>
<if test="recordId != null">record_id, </if>
<if test="userId != null">user_id, </if>
is_delete,
gmt_create,
gmt_modified
<if test="type != null">type, </if>
<if test="target != null">target, </if>
<if test="keyResult != null">key_result, </if>
<if test="checkWeight != null">check_weight, </if>
<if test="checkResult != null">check_result, </if>
<if test="superScore != null">super_score, </if>
<if test="acquireScore != null">acquire_score, </if>
<if test="scoreComment != null">score_comment, </if>
<if test="recordId != null">record_id, </if>
<if test="staffId != null">staff_id, </if>
<if test="priority != null">priority, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="type != null">#{ type}, </if>
<if test="target != null">#{ target}, </if>
<if test="keyResult != null">#{ keyResult}, </if>
<if test="checkWeight != null">#{ checkWeight}, </if>
<if test="checkResult != null">#{ checkResult}, </if>
<if test="superScore != null">#{ superScore}, </if>
<if test="acquireScore != null">#{ acquireScore}, </if>
<if test="scoreComment != null">#{ scoreComment}, </if>
<if test="recordId != null">#{ recordId}, </if>
<if test="userId != null">#{ userId}, </if>
0,
now(),
now()
<if test="type != null">#{ type}, </if>
<if test="target != null">#{ target}, </if>
<if test="keyResult != null">#{ keyResult}, </if>
<if test="checkWeight != null">#{ checkWeight}, </if>
<if test="checkResult != null">#{ checkResult}, </if>
<if test="superScore != null">#{ superScore}, </if>
<if test="acquireScore != null">#{ acquireScore}, </if>
<if test="scoreComment != null">#{ scoreComment}, </if>
<if test="recordId != null">#{ recordId}, </if>
<if test="staffId != null">#{ staffId}, </if>
<if test="priority != null">#{ priority}, </if>
0,
now(),
now()
)
</insert>
<update id="updateResultDetailById" parameterType="ResultDetail" >
update
lz_result_detail
lz_result_detail
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
@ -82,7 +85,8 @@
<if test="acquireScore != null">acquire_score = #{acquireScore},</if>
<if test="scoreComment != null">score_comment = #{scoreComment},</if>
<if test="recordId != null">record_id = #{recordId},</if>
<if test="userId != null">user_id = #{userId}</if>
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="priority != null">priority = #{priority}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -91,8 +95,8 @@
<update id="updateCoverResultDetailById" parameterType="ResultDetail" >
update
lz_result_detail
set
lz_result_detail
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
type = #{type},
@ -104,15 +108,24 @@
acquire_score = #{acquireScore},
score_comment = #{scoreComment},
record_id = #{recordId},
user_id = #{userId}
staff_id = #{staffId},
priority = #{priority}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteResultDetailById" parameterType="java.lang.Long">
update lz_result_detail set is_delete = 1 where id=#{id} limit 1
update lz_result_detail set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectByRecordId" resultType="com.lz.modules.sys.entity.app.ResultDetail">
select * from lz_result_detail where record_id=#{recordResultId} and is_delete = 0 order by type asc ,priority desc
</select>
</mapper>

View File

@ -81,6 +81,15 @@
<select id="selectByDepartmentId" resultType="com.lz.modules.app.entity.DepartmentsEntity">
select * from lz_departments where is_delete=0 and department_id =#{departmentId}
</select>
<select id="selectStaffAllDepartments" resultType="com.lz.modules.app.dto.StaffDepartmentDto">
select d.department_name department1 ,
c.department_name department2 ,
b.department_name department3,
a.department_name department4 from lz_departments a left join lz_departments b on a.department_parent_id = b.department_id
left join lz_departments c on b.department_parent_id = c.department_id
left join lz_departments d on d.department_id = c.department_parent_id
where a.department_id = #{departmentId}
</select>
</mapper>

View File

@ -60,8 +60,7 @@ public class MysqlMain {
file.mkdirs();
}
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_departments_staff_relate"));
list.add(new TablesBean("lz_departments"));
list.add(new TablesBean("lz_result_detail"));
List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();