Commit c9866eb6 authored by 廖旭伟's avatar 廖旭伟

达州考勤系统

parent 2e2a627f
...@@ -31,4 +31,8 @@ public class ParamKey { ...@@ -31,4 +31,8 @@ public class ParamKey {
public static String SYS_PARAM_XNJC_URL = "xnjc_url"; public static String SYS_PARAM_XNJC_URL = "xnjc_url";
public static String STAFF_CARE_BIRTHDAY_SEND = "StaffCareBirthdaySend";
public static String STAFF_CARE_ENTRYDATE_SEND = "StaffCareEntryDateSend";
} }
package com.mortals.xhx.daemon.task;
import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.staff.model.StaffCareEntity;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffCareService;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.*;
import static com.mortals.xhx.common.key.ParamKey.STAFF_CARE_BIRTHDAY_SEND;
import static com.mortals.xhx.common.key.ParamKey.STAFF_CARE_ENTRYDATE_SEND;
/**
* 员工关怀短信发送
*/
@Slf4j
@Service("SendStaffCareSMSTask")
public class SendStaffCareSMSTaskImpl implements ITaskExcuteService {
@Autowired
private StaffCareService staffCareService;
@Autowired
private ParamService paramService;
@Autowired
private StaffService staffService;
@Value("${sms.smsSendUrl:http://sms.wx3.com.cn/api/index/index}")
private String smsApiUrl;
@Value("${sms.apiId:ADsUXLrS81vZDU95}")
private String appid;
/**
* 短信模板ID
**/
private static String SMS_TPYE = "44";
@Override
public void excuteTask(ITask task) throws AppException {
Calendar calendar = Calendar.getInstance();
int month = calendar.get(Calendar.MONTH)+1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
if(month==1 && day==1){
//每年1月1日重置关怀短信发送状态
staffCareService.getDao().initSendStatus();
}
StaffCareEntity query = new StaffCareEntity();
query.setMonth(month);
query.setDay(day);
String StaffCareBirthdaySend = paramService.getValueByKey(STAFF_CARE_BIRTHDAY_SEND);
if(StringUtils.isEmpty(StaffCareBirthdaySend)){
StaffCareBirthdaySend="1";
}
String StaffCareEntryDateSend = paramService.getValueByKey(STAFF_CARE_ENTRYDATE_SEND);
if(StringUtils.isEmpty(StaffCareEntryDateSend)){
StaffCareEntryDateSend="1";
}
List<StaffCareEntity> staffCareList = staffCareService.getStaffCareList(query);
List<StaffCareEntity> updateList = new ArrayList<>();
if(StaffCareBirthdaySend.equals("1")) {
query.setCareType(1);
if (CollectionUtils.isNotEmpty(staffCareList)) {
for (StaffCareEntity item : staffCareList) {
StaffEntity staffEntity = staffService.getCache(item.getStaffId().toString());
if (staffEntity != null) {
String mobileNumber = staffEntity.getPhoneNumber();
if (StringUtils.isEmpty(mobileNumber)) {
continue;
}
if (PhoneUtil.isPhone(mobileNumber)) {
Map<String, String> params = new HashMap<>();
params.put("appid", appid);
params.put("phone", mobileNumber);
params.put("type", SMS_TPYE);
String[] json = new String[1];
json[0] = String.format("亲爱的[%s],祝你生日快乐!愿你在新的一岁里健康、快乐、成功!公司永远是你坚强的后盾。", item.getStaffName());
params.put("json", JSONObject.toJSON(json).toString());
try {
String resp = HttpUtil.doPost(smsApiUrl, params);
JSONObject respJson = JSONObject.parseObject(resp);
if (respJson.getIntValue("code") == 0) {
log.info("短信发送失败:" + respJson.getString("message"));
} else {
item.setSendStatus(1);
item.setExcuteTime(new Date());
item.setUpdateTime(new Date());
updateList.add(item);
}
} catch (Exception e) {
log.error("短信发送异常", e);
}
}
}
}
}
}
if(StaffCareEntryDateSend.equals("1")) {
query.setCareType(2);
staffCareList = staffCareService.getStaffCareList(query);
for (StaffCareEntity item : staffCareList) {
StaffEntity staffEntity = staffService.getCache(item.getStaffId().toString());
if (staffEntity != null) {
String mobileNumber = staffEntity.getPhoneNumber();
if (StringUtils.isEmpty(mobileNumber)) {
continue;
}
if (PhoneUtil.isPhone(mobileNumber)) {
Map<String, String> params = new HashMap<>();
params.put("appid", appid);
params.put("phone", mobileNumber);
params.put("type", SMS_TPYE);
String[] json = new String[1];
json[0] = String.format("亲爱的[%s],入职周年快乐!愿你一路走来的每一步都铺就了成功的基石,未来继续高飞,前程似锦!", item.getStaffName());
params.put("json", JSONObject.toJSON(json).toString());
try {
String resp = HttpUtil.doPost(smsApiUrl, params);
JSONObject respJson = JSONObject.parseObject(resp);
if (respJson.getIntValue("code") == 0) {
log.info("短信发送失败:" + respJson.getString("message"));
} else {
item.setSendStatus(1);
item.setExcuteTime(new Date());
item.setUpdateTime(new Date());
updateList.add(item);
}
} catch (Exception e) {
log.error("短信发送异常", e);
}
}
}
}
}
if(updateList.size()>0){
staffCareService.update(updateList);
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
...@@ -25,7 +25,6 @@ public class JobServiceImpl extends AbstractCRUDServiceImpl<JobDao, JobEntity, L ...@@ -25,7 +25,6 @@ public class JobServiceImpl extends AbstractCRUDServiceImpl<JobDao, JobEntity, L
protected void findAfter(JobEntity entity, Context context, List<JobEntity> list) throws AppException { protected void findAfter(JobEntity entity, Context context, List<JobEntity> list) throws AppException {
list.stream().peek(item -> { list.stream().peek(item -> {
List<JobEntity> childs = this.find(new JobQuery().groupId(item.getId())); List<JobEntity> childs = this.find(new JobQuery().groupId(item.getId()));
System.out.println("111"+childs);
if (!ObjectUtils.isEmpty(childs)) { if (!ObjectUtils.isEmpty(childs)) {
item.setChildren(childs); item.setChildren(childs);
} else { } else {
......
...@@ -2,16 +2,22 @@ package com.mortals.xhx.module.staff.dao; ...@@ -2,16 +2,22 @@ package com.mortals.xhx.module.staff.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.staff.model.StaffCareEntity; import com.mortals.xhx.module.staff.model.StaffCareEntity;
import com.mortals.xhx.module.staff.model.StaffCareQuery;
import java.util.List; import java.util.List;
/** /**
* 员工关怀信息Dao * 员工关怀信息Dao
* 员工关怀信息 DAO接口 * 员工关怀信息 DAO接口
* *
* @author zxfei * @author zxfei
* @date 2023-04-07 * @date 2023-04-07
*/ */
public interface StaffCareDao extends ICRUDDao<StaffCareEntity,Long>{ public interface StaffCareDao extends ICRUDDao<StaffCareEntity,Long>{
List<StaffCareEntity> getStaffCareList(StaffCareEntity query);
int getStaffCareListCount(StaffCareEntity query);
int initSendStatus();
} }
package com.mortals.xhx.module.staff.dao.ibatis; package com.mortals.xhx.module.staff.dao.ibatis;
import org.springframework.stereotype.Repository; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.staff.dao.StaffCareDao; import com.mortals.xhx.module.staff.dao.StaffCareDao;
import com.mortals.xhx.module.staff.model.StaffCareEntity; import com.mortals.xhx.module.staff.model.StaffCareEntity;
import java.util.Date; import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List; import java.util.List;
/** /**
* 员工关怀信息DaoImpl DAO接口 * 员工关怀信息DaoImpl DAO接口
* *
* @author zxfei * @author zxfei
* @date 2023-04-07 * @date 2023-04-07
*/ */
@Repository("staffCareDao") @Repository("staffCareDao")
public class StaffCareDaoImpl extends BaseCRUDDaoMybatis<StaffCareEntity,Long> implements StaffCareDao { public class StaffCareDaoImpl extends BaseCRUDDaoMybatis<StaffCareEntity,Long> implements StaffCareDao {
@Override
public List<StaffCareEntity> getStaffCareList(StaffCareEntity query) {
return this.getSqlSession().selectList(this.getSqlId("getStaffCareList"), query);
}
@Override
public int getStaffCareListCount(StaffCareEntity query) {
return (Integer)this.getSqlSession().selectOne(this.getSqlId("getStaffCareListCount"), query);
}
@Override
public int initSendStatus() {
return this.getSqlSession().update(this.getSqlId("initSendStatus"));
}
} }
package com.mortals.xhx.module.staff.model; package com.mortals.xhx.module.staff.model;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.staff.model.vo.StaffCareVo; import com.mortals.xhx.module.staff.model.vo.StaffCareVo;
import lombok.Data;
/** /**
* 员工关怀信息实体对象 * 员工关怀信息实体对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-07 * @date 2025-04-15
*/ */
@Data
public class StaffCareEntity extends StaffCareVo { public class StaffCareEntity extends StaffCareVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -61,168 +64,14 @@ public class StaffCareEntity extends StaffCareVo { ...@@ -61,168 +64,14 @@ public class StaffCareEntity extends StaffCareVo {
* 关怀内容 * 关怀内容
*/ */
private String content; private String content;
public StaffCareEntity(){}
/**
* 获取 员工ID
* @return Long
*/
public Long getStaffId(){
return staffId;
}
/**
* 设置 员工ID
* @param staffId
*/
public void setStaffId(Long staffId){
this.staffId = staffId;
}
/**
* 获取 员工姓名
* @return String
*/
public String getStaffName(){
return staffName;
}
/**
* 设置 员工姓名
* @param staffName
*/
public void setStaffName(String staffName){
this.staffName = staffName;
}
/**
* 获取 出生日期
* @return Date
*/
public Date getBirthday(){
return birthday;
}
/**
* 设置 出生日期
* @param birthday
*/
public void setBirthday(Date birthday){
this.birthday = birthday;
}
/**
* 获取 所属部门
* @return Long
*/
public Long getDeptId(){
return deptId;
}
/**
* 设置 所属部门
* @param deptId
*/
public void setDeptId(Long deptId){
this.deptId = deptId;
}
/**
* 获取 所属部门名称
* @return String
*/
public String getDeptName(){
return deptName;
}
/**
* 设置 所属部门名称
* @param deptName
*/
public void setDeptName(String deptName){
this.deptName = deptName;
}
/**
* 获取 职位ID
* @return Long
*/
public Long getJobId(){
return jobId;
}
/**
* 设置 职位ID
* @param jobId
*/
public void setJobId(Long jobId){
this.jobId = jobId;
}
/** /**
* 获取 职位名称 * 执行时间
* @return String
*/ */
public String getJobName(){ private Date excuteTime;
return jobName;
}
/**
* 设置 职位名称
* @param jobName
*/
public void setJobName(String jobName){
this.jobName = jobName;
}
/**
* 获取 入职时间
* @return Date
*/
public Date getEntryDate(){
return entryDate;
}
/**
* 设置 入职时间
* @param entryDate
*/
public void setEntryDate(Date entryDate){
this.entryDate = entryDate;
}
/**
* 获取 关怀类型(1.生日关怀,2.入职周年关怀)
* @return Integer
*/
public Integer getCareType(){
return careType;
}
/**
* 设置 关怀类型(1.生日关怀,2.入职周年关怀)
* @param careType
*/
public void setCareType(Integer careType){
this.careType = careType;
}
/**
* 获取 发送状态(0.未发送,1.已发送)
* @return Integer
*/
public Integer getSendStatus(){
return sendStatus;
}
/**
* 设置 发送状态(0.未发送,1.已发送)
* @param sendStatus
*/
public void setSendStatus(Integer sendStatus){
this.sendStatus = sendStatus;
}
/** /**
* 获取 关怀内容 * 员工类型(1.全职,2.兼职,3.实习)
* @return String
*/ */
public String getContent(){ private Integer staffType;
return content;
}
/**
* 设置 关怀内容
* @param content
*/
public void setContent(String content){
this.content = content;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -239,44 +88,19 @@ public class StaffCareEntity extends StaffCareVo { ...@@ -239,44 +88,19 @@ public class StaffCareEntity extends StaffCareVo {
return false; return false;
} }
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",staffId:").append(getStaffId());
sb.append(",staffName:").append(getStaffName());
sb.append(",birthday:").append(getBirthday());
sb.append(",deptId:").append(getDeptId());
sb.append(",deptName:").append(getDeptName());
sb.append(",jobId:").append(getJobId());
sb.append(",jobName:").append(getJobName());
sb.append(",entryDate:").append(getEntryDate());
sb.append(",careType:").append(getCareType());
sb.append(",sendStatus:").append(getSendStatus());
sb.append(",content:").append(getContent());
return sb.toString();
}
public void initAttrValue(){ public void initAttrValue(){
this.staffId = null; this.staffId = null;
this.staffName = ""; this.staffName = "";
this.birthday = null; this.birthday = null;
this.deptId = null; this.deptId = null;
this.deptName = ""; this.deptName = "";
this.jobId = null; this.jobId = null;
this.jobName = ""; this.jobName = "";
this.entryDate = null; this.entryDate = null;
this.careType = 1; this.careType = 1;
this.sendStatus = 0; this.sendStatus = 0;
this.content = ""; this.content = "";
this.excuteTime = null;
this.staffType = 0;
} }
} }
\ No newline at end of file
...@@ -4,11 +4,11 @@ import java.util.Date; ...@@ -4,11 +4,11 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.mortals.xhx.module.staff.model.StaffCareEntity; import com.mortals.xhx.module.staff.model.StaffCareEntity;
/** /**
* 员工关怀信息查询对象 * 员工关怀信息查询对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-07 * @date 2025-04-15
*/ */
public class StaffCareQuery extends StaffCareEntity { public class StaffCareQuery extends StaffCareEntity {
/** 开始 序号,主键,自增长 */ /** 开始 序号,主键,自增长 */
private Long idStart; private Long idStart;
...@@ -174,6 +174,27 @@ public class StaffCareQuery extends StaffCareEntity { ...@@ -174,6 +174,27 @@ public class StaffCareQuery extends StaffCareEntity {
/** 结束 更新时间 */ /** 结束 更新时间 */
private String updateTimeEnd; private String updateTimeEnd;
/** 开始 执行时间 */
private String excuteTimeStart;
/** 结束 执行时间 */
private String excuteTimeEnd;
/** 开始 员工类型(1.全职,2.兼职,3.实习) */
private Integer staffTypeStart;
/** 结束 员工类型(1.全职,2.兼职,3.实习) */
private Integer staffTypeEnd;
/** 增加 员工类型(1.全职,2.兼职,3.实习) */
private Integer staffTypeIncrement;
/** 员工类型(1.全职,2.兼职,3.实习)列表 */
private List <Integer> staffTypeList;
/** 员工类型(1.全职,2.兼职,3.实习)排除列表 */
private List <Integer> staffTypeNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<StaffCareQuery> orConditionList; private List<StaffCareQuery> orConditionList;
...@@ -1086,6 +1107,119 @@ public class StaffCareQuery extends StaffCareEntity { ...@@ -1086,6 +1107,119 @@ public class StaffCareQuery extends StaffCareEntity {
this.updateTimeEnd = updateTimeEnd; this.updateTimeEnd = updateTimeEnd;
} }
/**
* 获取 开始 执行时间
* @return excuteTimeStart
*/
public String getExcuteTimeStart(){
return this.excuteTimeStart;
}
/**
* 设置 开始 执行时间
* @param excuteTimeStart
*/
public void setExcuteTimeStart(String excuteTimeStart){
this.excuteTimeStart = excuteTimeStart;
}
/**
* 获取 结束 执行时间
* @return excuteTimeEnd
*/
public String getExcuteTimeEnd(){
return this.excuteTimeEnd;
}
/**
* 设置 结束 执行时间
* @param excuteTimeEnd
*/
public void setExcuteTimeEnd(String excuteTimeEnd){
this.excuteTimeEnd = excuteTimeEnd;
}
/**
* 获取 开始 员工类型(1.全职,2.兼职,3.实习)
* @return staffTypeStart
*/
public Integer getStaffTypeStart(){
return this.staffTypeStart;
}
/**
* 设置 开始 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeStart
*/
public void setStaffTypeStart(Integer staffTypeStart){
this.staffTypeStart = staffTypeStart;
}
/**
* 获取 结束 员工类型(1.全职,2.兼职,3.实习)
* @return $staffTypeEnd
*/
public Integer getStaffTypeEnd(){
return this.staffTypeEnd;
}
/**
* 设置 结束 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeEnd
*/
public void setStaffTypeEnd(Integer staffTypeEnd){
this.staffTypeEnd = staffTypeEnd;
}
/**
* 获取 增加 员工类型(1.全职,2.兼职,3.实习)
* @return staffTypeIncrement
*/
public Integer getStaffTypeIncrement(){
return this.staffTypeIncrement;
}
/**
* 设置 增加 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeIncrement
*/
public void setStaffTypeIncrement(Integer staffTypeIncrement){
this.staffTypeIncrement = staffTypeIncrement;
}
/**
* 获取 员工类型(1.全职,2.兼职,3.实习)
* @return staffTypeList
*/
public List<Integer> getStaffTypeList(){
return this.staffTypeList;
}
/**
* 设置 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeList
*/
public void setStaffTypeList(List<Integer> staffTypeList){
this.staffTypeList = staffTypeList;
}
/**
* 获取 员工类型(1.全职,2.兼职,3.实习)
* @return staffTypeNotList
*/
public List<Integer> getStaffTypeNotList(){
return this.staffTypeNotList;
}
/**
* 设置 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeNotList
*/
public void setStaffTypeNotList(List<Integer> staffTypeNotList){
this.staffTypeNotList = staffTypeNotList;
}
/** /**
* 设置 序号,主键,自增长 * 设置 序号,主键,自增长
* @param id * @param id
...@@ -1598,6 +1732,61 @@ public class StaffCareQuery extends StaffCareEntity { ...@@ -1598,6 +1732,61 @@ public class StaffCareQuery extends StaffCareEntity {
} }
/**
* 设置 员工类型(1.全职,2.兼职,3.实习)
* @param staffType
*/
public StaffCareQuery staffType(Integer staffType){
setStaffType(staffType);
return this;
}
/**
* 设置 开始 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeStart
*/
public StaffCareQuery staffTypeStart(Integer staffTypeStart){
this.staffTypeStart = staffTypeStart;
return this;
}
/**
* 设置 结束 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeEnd
*/
public StaffCareQuery staffTypeEnd(Integer staffTypeEnd){
this.staffTypeEnd = staffTypeEnd;
return this;
}
/**
* 设置 增加 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeIncrement
*/
public StaffCareQuery staffTypeIncrement(Integer staffTypeIncrement){
this.staffTypeIncrement = staffTypeIncrement;
return this;
}
/**
* 设置 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeList
*/
public StaffCareQuery staffTypeList(List<Integer> staffTypeList){
this.staffTypeList = staffTypeList;
return this;
}
/**
* 设置 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeNotList
*/
public StaffCareQuery staffTypeNotList(List<Integer> staffTypeNotList){
this.staffTypeNotList = staffTypeNotList;
return this;
}
/** /**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) * 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList * @return orConditionList
......
package com.mortals.xhx.module.staff.model.vo; package com.mortals.xhx.module.staff.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.staff.model.StaffCareEntity; import com.mortals.xhx.module.staff.model.StaffCareEntity;
import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* 员工关怀信息视图对象 * 员工关怀信息视图对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-07 * @date 2023-04-07
*/ */
@Data
public class StaffCareVo extends BaseEntityLong { public class StaffCareVo extends BaseEntityLong {
/**
* 年
*/
private Integer year;
/**
* 月
*/
private Integer month;
/**
* 日
*/
private Integer day;
/** 参数键,*/
private String paramType;
/** 参数值 */
private Integer paramValue;
} }
\ No newline at end of file
package com.mortals.xhx.module.staff.service; package com.mortals.xhx.module.staff.service;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.staff.dao.StaffCareDao;
import com.mortals.xhx.module.staff.model.StaffCareEntity; import com.mortals.xhx.module.staff.model.StaffCareEntity;
import com.mortals.xhx.module.staff.model.StaffCareQuery;
import java.util.List;
/** /**
* StaffCareService * StaffCareService
* *
* 员工关怀信息 service接口 * 员工关怀信息 service接口
* *
* @author zxfei * @author zxfei
* @date 2023-04-07 * @date 2023-04-07
*/ */
public interface StaffCareService extends ICRUDService<StaffCareEntity,Long>{ public interface StaffCareService extends ICRUDService<StaffCareEntity,Long>{
StaffCareDao getDao();
List<StaffCareEntity> getStaffCareList(StaffCareEntity query);
int getStaffCareListCount(StaffCareEntity query);
} }
\ No newline at end of file
package com.mortals.xhx.module.staff.service.impl; package com.mortals.xhx.module.staff.service.impl;
import com.mortals.xhx.module.staff.model.StaffCareQuery;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -6,14 +7,26 @@ import com.mortals.framework.model.Context; ...@@ -6,14 +7,26 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.staff.dao.StaffCareDao; import com.mortals.xhx.module.staff.dao.StaffCareDao;
import com.mortals.xhx.module.staff.model.StaffCareEntity; import com.mortals.xhx.module.staff.model.StaffCareEntity;
import com.mortals.xhx.module.staff.service.StaffCareService; import com.mortals.xhx.module.staff.service.StaffCareService;
import java.util.List;
/** /**
* StaffCareService * StaffCareService
* 员工关怀信息 service实现 * 员工关怀信息 service实现
* *
* @author zxfei * @author zxfei
* @date 2023-04-07 * @date 2023-04-07
*/ */
@Service("staffCareService") @Service("staffCareService")
public class StaffCareServiceImpl extends AbstractCRUDServiceImpl<StaffCareDao, StaffCareEntity, Long> implements StaffCareService { public class StaffCareServiceImpl extends AbstractCRUDServiceImpl<StaffCareDao, StaffCareEntity, Long> implements StaffCareService {
@Override
public List<StaffCareEntity> getStaffCareList(StaffCareEntity query) {
return this.dao.getStaffCareList(query);
}
@Override
public int getStaffCareListCount(StaffCareEntity query) {
return this.dao.getStaffCareListCount(query);
}
} }
\ No newline at end of file
package com.mortals.xhx.module.staff.web; package com.mortals.xhx.module.staff.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.model.ParamEntity;
import com.mortals.xhx.base.system.param.model.ParamQuery;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.CareTypeEnum; import com.mortals.xhx.common.code.CareTypeEnum;
import com.mortals.xhx.common.code.SendStatusEnum; import com.mortals.xhx.common.code.SendStatusEnum;
...@@ -11,10 +16,12 @@ import com.mortals.xhx.module.dept.service.DeptService; ...@@ -11,10 +16,12 @@ import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.job.model.JobEntity; import com.mortals.xhx.module.job.model.JobEntity;
import com.mortals.xhx.module.job.model.JobQuery; import com.mortals.xhx.module.job.model.JobQuery;
import com.mortals.xhx.module.job.service.JobService; import com.mortals.xhx.module.job.service.JobService;
import com.mortals.xhx.module.staff.model.StaffCareQuery;
import com.mortals.xhx.module.staff.model.StaffEntity; import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffQuery; import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffService; import com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -30,19 +37,16 @@ import com.mortals.xhx.module.staff.service.StaffCareService; ...@@ -30,19 +37,16 @@ import com.mortals.xhx.module.staff.service.StaffCareService;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import static com.mortals.framework.ap.SysConstains.*;
import static com.mortals.xhx.common.key.ParamKey.*;
/** /**
* 员工关怀信息 * 员工关怀信息
...@@ -64,6 +68,7 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff ...@@ -64,6 +68,7 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff
@Autowired @Autowired
private JobService jobService; private JobService jobService;
public StaffCareController() { public StaffCareController() {
super.setModuleDesc("员工关怀信息"); super.setModuleDesc("员工关怀信息");
} }
...@@ -75,7 +80,7 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff ...@@ -75,7 +80,7 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff
this.addDict(model, "deptId", deptService.find(new DeptQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getDeptName()))); this.addDict(model, "deptId", deptService.find(new DeptQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getDeptName())));
this.addDict(model, "jobId", jobService.find(new JobQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getJobName()))); this.addDict(model, "jobId", jobService.find(new JobQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getJobName())));
this.addDict(model, "staffId", staffService.find(new StaffQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getName()))); this.addDict(model, "staffId", staffService.find(new StaffQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getName())));
this.addDict(model, "staffType", paramService.getParamBySecondOrganize("Staff", "staffType"));
super.init(model, context); super.init(model, context);
} }
...@@ -90,6 +95,8 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff ...@@ -90,6 +95,8 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff
if (!ObjectUtils.isEmpty(entity.getStaffId())) { if (!ObjectUtils.isEmpty(entity.getStaffId())) {
StaffEntity staffEntity = staffService.getCache(entity.getStaffId().toString()); StaffEntity staffEntity = staffService.getCache(entity.getStaffId().toString());
entity.setStaffName(staffEntity == null ? "" : staffEntity.getName()); entity.setStaffName(staffEntity == null ? "" : staffEntity.getName());
entity.setDeptId(staffEntity == null ? null : staffEntity.getDeptId());
entity.setStaffType(staffEntity == null ? null : staffEntity.getStaffType());
} }
if (!ObjectUtils.isEmpty(entity.getDeptId())) { if (!ObjectUtils.isEmpty(entity.getDeptId())) {
DeptEntity deptEntity = deptService.get(entity.getDeptId(), context); DeptEntity deptEntity = deptService.get(entity.getDeptId(), context);
...@@ -97,4 +104,66 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff ...@@ -97,4 +104,66 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff
} }
} }
@Override
protected void doListBefore(StaffCareEntity query, Map<String, Object> model, Context context) throws AppException {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH)+1;
if(query.getYear()==null){
query.setYear(year);
}
if(query.getMonth()==null){
query.setMonth(month);
}
}
@Override
protected int doListAfter(StaffCareEntity query, Map<String, Object> model, Context context) throws AppException {
query.setCareType(1);
int shengri = this.service.getStaffCareListCount(query);
query.setCareType(2);
int ruzhi = this.service.getStaffCareListCount(query);
model.put("shengri", shengri);
model.put("ruzhi", ruzhi);
model.put(STAFF_CARE_BIRTHDAY_SEND, paramService.getValueByKey(STAFF_CARE_BIRTHDAY_SEND));
model.put(STAFF_CARE_ENTRYDATE_SEND, paramService.getValueByKey(STAFF_CARE_ENTRYDATE_SEND));
return 1;
}
/**
* 设置关怀发送开关
* @param query
* @return
*/
@PostMapping({"sendSwitch"})
public String sendSwitch(@RequestBody StaffCareEntity query) {
Map<String, Object> model = new HashMap();
int code = 1;
String busiDesc = "设置关怀发送开关";
try {
if(StringUtils.isNotEmpty(query.getParamType())){
ParamQuery paramQuery = new ParamQuery();
paramQuery.setParamKey(query.getParamType());
ParamEntity paramEntity = paramService.selectOne(paramQuery);
if(paramEntity!=null){
paramEntity.setParamValue(String.valueOf(query.getParamValue()));
paramService.update(paramEntity);
}
}
model.put("message_info", busiDesc + " 【成功】");
this.recordSysLog(this.request, busiDesc + " 【成功】 ");
} catch (Exception var7) {
code = -1;
this.doException(this.request, busiDesc, model, var7);
}
JSONObject ret = new JSONObject();
ret.put("code", Integer.valueOf(code));
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
} }
\ No newline at end of file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor"> <plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor">
<property name="enableExecutorTime" value="false" /> <property name="enableExecutorTime" value="false" />
<property name="showSql" value="false" /> <property name="showSql" value="true" />
</plugin> </plugin>
<!-- <plugin interceptor="com.mortals.framework.thirty.dm.DmTransInterceptor">--> <!-- <plugin interceptor="com.mortals.framework.thirty.dm.DmTransInterceptor">-->
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd"> "mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.staff.dao.ibatis.StaffCareDaoImpl"> <mapper namespace="com.mortals.xhx.module.staff.dao.ibatis.StaffCareDaoImpl">
<!-- 字段和属性映射 --> <!-- 字段和属性映射 -->
<resultMap type="StaffCareEntity" id="StaffCareEntity-Map"> <resultMap type="StaffCareEntity" id="StaffCareEntity-Map">
<id property="id" column="id" /> <id property="id" column="id" />
<id property="staffId" column="staffId" /> <result property="staffId" column="staffId" />
<result property="staffName" column="staffName" /> <result property="staffName" column="staffName" />
<result property="birthday" column="birthday" /> <result property="birthday" column="birthday" />
<result property="deptId" column="deptId" /> <result property="deptId" column="deptId" />
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
<result property="createTime" column="createTime" /> <result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" /> <result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" /> <result property="updateTime" column="updateTime" />
<result property="excuteTime" column="excuteTime" />
<result property="staffType" column="staffType" />
</resultMap> </resultMap>
<!-- 表所有列 --> <!-- 表所有列 -->
<sql id="_columns"> <sql id="_columns">
<trim suffixOverrides="," suffix=""> <trim suffixOverrides="," suffix="">
...@@ -76,23 +76,29 @@ ...@@ -76,23 +76,29 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime, a.updateTime,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('excuteTime') or colPickMode == 1 and data.containsKey('excuteTime')))">
a.excuteTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('staffType') or colPickMode == 1 and data.containsKey('staffType')))">
a.staffType,
</if>
</trim> </trim>
</sql> </sql>
<!-- 新增 区分主键自增加还是业务插入 --> <!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="StaffCareEntity" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="StaffCareEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_staff_care insert into mortals_xhx_staff_care
(staffId,staffName,birthday,deptId,deptName,jobId,jobName,entryDate,careType,sendStatus,content,createUserId,createTime,updateUserId,updateTime) (staffId,staffName,birthday,deptId,deptName,jobId,jobName,entryDate,careType,sendStatus,content,createUserId,createTime,updateUserId,updateTime,excuteTime,staffType)
VALUES VALUES
(#{staffId},#{staffName},#{birthday},#{deptId},#{deptName},#{jobId},#{jobName},#{entryDate},#{careType},#{sendStatus},#{content},#{createUserId},#{createTime},#{updateUserId},#{updateTime}) (#{staffId},#{staffName},#{birthday},#{deptId},#{deptName},#{jobId},#{jobName},#{entryDate},#{careType},#{sendStatus},#{content},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{excuteTime},#{staffType})
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto"> <insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_staff_care insert into mortals_xhx_staff_care
(staffId,staffName,birthday,deptId,deptName,jobId,jobName,entryDate,careType,sendStatus,content,createUserId,createTime,updateUserId,updateTime) (staffId,staffName,birthday,deptId,deptName,jobId,jobName,entryDate,careType,sendStatus,content,createUserId,createTime,updateUserId,updateTime,excuteTime,staffType)
VALUES VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," > <foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.staffId},#{item.staffName},#{item.birthday},#{item.deptId},#{item.deptName},#{item.jobId},#{item.jobName},#{item.entryDate},#{item.careType},#{item.sendStatus},#{item.content},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime}) (#{item.staffId},#{item.staffName},#{item.birthday},#{item.deptId},#{item.deptName},#{item.jobId},#{item.jobName},#{item.entryDate},#{item.careType},#{item.sendStatus},#{item.content},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.excuteTime},#{item.staffType})
</foreach> </foreach>
</insert> </insert>
...@@ -168,6 +174,15 @@ ...@@ -168,6 +174,15 @@
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))"> <if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime}, a.updateTime=#{data.updateTime},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('excuteTime')) or (colPickMode==1 and !data.containsKey('excuteTime'))">
a.excuteTime=#{data.excuteTime},
</if>
<if test="(colPickMode==0 and data.containsKey('staffType')) or (colPickMode==1 and !data.containsKey('staffType'))">
a.staffType=#{data.staffType},
</if>
<if test="(colPickMode==0 and data.containsKey('staffTypeIncrement')) or (colPickMode==1 and !data.containsKey('staffTypeIncrement'))">
a.staffType=ifnull(a.staffType,0) + #{data.staffTypeIncrement},
</if>
</trim> </trim>
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
where where
...@@ -320,6 +335,25 @@ ...@@ -320,6 +335,25 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="excuteTime=(case" suffix="ELSE excuteTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('excuteTime')) or (colPickMode==1 and !item.containsKey('excuteTime'))">
when a.id=#{item.id} then #{item.excuteTime}
</if>
</foreach>
</trim>
<trim prefix="staffType=(case" suffix="ELSE staffType end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('staffType')) or (colPickMode==1 and !item.containsKey('staffType'))">
when a.id=#{item.id} then #{item.staffType}
</when>
<when test="(colPickMode==0 and item.containsKey('staffTypeIncrement')) or (colPickMode==1 and !item.containsKey('staffTypeIncrement'))">
when a.id=#{item.id} then ifnull(a.staffType,0) + #{item.staffTypeIncrement}
</when>
</choose>
</foreach>
</trim>
</trim> </trim>
where id in where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")"> <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
...@@ -334,7 +368,7 @@ ...@@ -334,7 +368,7 @@
</select> </select>
<!-- 根据主健删除 --> <!-- 根据主健删除 -->
<delete id="deleteByKey" parameterType="paramDto"> <delete id="deleteByKey" parameterType="paramDto">
delete a.* from mortals_xhx_staff_care as a where a.id=#{condition.id} delete from mortals_xhx_staff_care as a where a.id=#{condition.id}
</delete> </delete>
<!-- 根据主健删除一批,针对单一主健有效 --> <!-- 根据主健删除一批,针对单一主健有效 -->
<delete id="deleteByKeys"> <delete id="deleteByKeys">
...@@ -431,6 +465,10 @@ ...@@ -431,6 +465,10 @@
<!-- 条件映射-代参数 --> <!-- 条件映射-代参数 -->
<sql id="_condition_param_"> <sql id="_condition_param_">
<bind name="conditionParamRef" value="${_conditionParam_}"/> <bind name="conditionParamRef" value="${_conditionParam_}"/>
<if test="permissionSql != null and permissionSql != ''">
${permissionSql}
</if>
<if test="conditionParamRef.containsKey('id')"> <if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null"> <if test="conditionParamRef.id != null">
${_conditionType_} a.id=#{${_conditionParam_}.id} ${_conditionType_} a.id=#{${_conditionParam_}.id}
...@@ -444,13 +482,13 @@ ...@@ -444,13 +482,13 @@
${_conditionType_} a.id is null ${_conditionType_} a.id is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('idList')"> <if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
${_conditionType_} a.id in ${_conditionType_} a.id in
<foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('idNotList')"> <if test="conditionParamRef.containsKey('idNotList') and conditionParamRef.idNotList.size() > 0">
${_conditionType_} a.id not in ${_conditionType_} a.id not in
<foreach collection="conditionParamRef.idNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.idNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -471,13 +509,13 @@ ...@@ -471,13 +509,13 @@
${_conditionType_} a.staffId is null ${_conditionType_} a.staffId is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('staffIdList')"> <if test="conditionParamRef.containsKey('staffIdList') and conditionParamRef.staffIdList.size() > 0">
${_conditionType_} a.staffId in ${_conditionType_} a.staffId in
<foreach collection="conditionParamRef.staffIdList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.staffIdList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('staffIdNotList')"> <if test="conditionParamRef.containsKey('staffIdNotList') and conditionParamRef.staffIdNotList.size() > 0">
${_conditionType_} a.staffId not in ${_conditionType_} a.staffId not in
<foreach collection="conditionParamRef.staffIdNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.staffIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -499,13 +537,13 @@ ...@@ -499,13 +537,13 @@
${_conditionType_} a.staffName is null ${_conditionType_} a.staffName is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('staffNameList')"> <if test="conditionParamRef.containsKey('staffNameList') and conditionParamRef.staffNameList.size() > 0">
${_conditionType_} a.staffName in ${_conditionType_} a.staffName in
<foreach collection="conditionParamRef.staffNameList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.staffNameList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('staffNameNotList')"> <if test="conditionParamRef.containsKey('staffNameNotList') and conditionParamRef.staffNameNotList.size() > 0">
${_conditionType_} a.staffName not in ${_conditionType_} a.staffName not in
<foreach collection="conditionParamRef.staffNameNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.staffNameNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -534,13 +572,13 @@ ...@@ -534,13 +572,13 @@
${_conditionType_} a.deptId is null ${_conditionType_} a.deptId is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('deptIdList')"> <if test="conditionParamRef.containsKey('deptIdList') and conditionParamRef.deptIdList.size() > 0">
${_conditionType_} a.deptId in ${_conditionType_} a.deptId in
<foreach collection="conditionParamRef.deptIdList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.deptIdList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('deptIdNotList')"> <if test="conditionParamRef.containsKey('deptIdNotList') and conditionParamRef.deptIdNotList.size() > 0">
${_conditionType_} a.deptId not in ${_conditionType_} a.deptId not in
<foreach collection="conditionParamRef.deptIdNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.deptIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -562,13 +600,13 @@ ...@@ -562,13 +600,13 @@
${_conditionType_} a.deptName is null ${_conditionType_} a.deptName is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('deptNameList')"> <if test="conditionParamRef.containsKey('deptNameList') and conditionParamRef.deptNameList.size() > 0">
${_conditionType_} a.deptName in ${_conditionType_} a.deptName in
<foreach collection="conditionParamRef.deptNameList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.deptNameList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('deptNameNotList')"> <if test="conditionParamRef.containsKey('deptNameNotList') and conditionParamRef.deptNameNotList.size() > 0">
${_conditionType_} a.deptName not in ${_conditionType_} a.deptName not in
<foreach collection="conditionParamRef.deptNameNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.deptNameNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -582,13 +620,13 @@ ...@@ -582,13 +620,13 @@
${_conditionType_} a.jobId is null ${_conditionType_} a.jobId is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('jobIdList')"> <if test="conditionParamRef.containsKey('jobIdList') and conditionParamRef.jobIdList.size() > 0">
${_conditionType_} a.jobId in ${_conditionType_} a.jobId in
<foreach collection="conditionParamRef.jobIdList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.jobIdList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('jobIdNotList')"> <if test="conditionParamRef.containsKey('jobIdNotList') and conditionParamRef.jobIdNotList.size() > 0">
${_conditionType_} a.jobId not in ${_conditionType_} a.jobId not in
<foreach collection="conditionParamRef.jobIdNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.jobIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -610,13 +648,13 @@ ...@@ -610,13 +648,13 @@
${_conditionType_} a.jobName is null ${_conditionType_} a.jobName is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('jobNameList')"> <if test="conditionParamRef.containsKey('jobNameList') and conditionParamRef.jobNameList.size() > 0">
${_conditionType_} a.jobName in ${_conditionType_} a.jobName in
<foreach collection="conditionParamRef.jobNameList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.jobNameList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('jobNameNotList')"> <if test="conditionParamRef.containsKey('jobNameNotList') and conditionParamRef.jobNameNotList.size() > 0">
${_conditionType_} a.jobName not in ${_conditionType_} a.jobName not in
<foreach collection="conditionParamRef.jobNameNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.jobNameNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -645,13 +683,13 @@ ...@@ -645,13 +683,13 @@
${_conditionType_} a.careType is null ${_conditionType_} a.careType is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('careTypeList')"> <if test="conditionParamRef.containsKey('careTypeList') and conditionParamRef.careTypeList.size() > 0">
${_conditionType_} a.careType in ${_conditionType_} a.careType in
<foreach collection="conditionParamRef.careTypeList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.careTypeList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('careTypeNotList')"> <if test="conditionParamRef.containsKey('careTypeNotList') and conditionParamRef.careTypeNotList.size() > 0">
${_conditionType_} a.careType not in ${_conditionType_} a.careType not in
<foreach collection="conditionParamRef.careTypeNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.careTypeNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -672,13 +710,13 @@ ...@@ -672,13 +710,13 @@
${_conditionType_} a.sendStatus is null ${_conditionType_} a.sendStatus is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('sendStatusList')"> <if test="conditionParamRef.containsKey('sendStatusList') and conditionParamRef.sendStatusList.size() > 0">
${_conditionType_} a.sendStatus in ${_conditionType_} a.sendStatus in
<foreach collection="conditionParamRef.sendStatusList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.sendStatusList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('sendStatusNotList')"> <if test="conditionParamRef.containsKey('sendStatusNotList') and conditionParamRef.sendStatusNotList.size() > 0">
${_conditionType_} a.sendStatus not in ${_conditionType_} a.sendStatus not in
<foreach collection="conditionParamRef.sendStatusNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.sendStatusNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -700,13 +738,13 @@ ...@@ -700,13 +738,13 @@
${_conditionType_} a.content is null ${_conditionType_} a.content is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('contentList')"> <if test="conditionParamRef.containsKey('contentList') and conditionParamRef.contentList.size() > 0">
${_conditionType_} a.content in ${_conditionType_} a.content in
<foreach collection="conditionParamRef.contentList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.contentList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('contentNotList')"> <if test="conditionParamRef.containsKey('contentNotList') and conditionParamRef.contentNotList.size() > 0">
${_conditionType_} a.content not in ${_conditionType_} a.content not in
<foreach collection="conditionParamRef.contentNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.contentNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -720,13 +758,13 @@ ...@@ -720,13 +758,13 @@
${_conditionType_} a.createUserId is null ${_conditionType_} a.createUserId is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('createUserIdList')"> <if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
${_conditionType_} a.createUserId in ${_conditionType_} a.createUserId in
<foreach collection="conditionParamRef.createUserIdList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('createUserIdNotList')"> <if test="conditionParamRef.containsKey('createUserIdNotList') and conditionParamRef.createUserIdNotList.size() > 0">
${_conditionType_} a.createUserId not in ${_conditionType_} a.createUserId not in
<foreach collection="conditionParamRef.createUserIdNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.createUserIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -762,13 +800,13 @@ ...@@ -762,13 +800,13 @@
${_conditionType_} a.updateUserId is null ${_conditionType_} a.updateUserId is null
</if> </if>
</if> </if>
<if test="conditionParamRef.containsKey('updateUserIdList')"> <if test="conditionParamRef.containsKey('updateUserIdList') and conditionParamRef.updateUserIdList.size() > 0">
${_conditionType_} a.updateUserId in ${_conditionType_} a.updateUserId in
<foreach collection="conditionParamRef.updateUserIdList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.updateUserIdList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('updateUserIdNotList')"> <if test="conditionParamRef.containsKey('updateUserIdNotList') and conditionParamRef.updateUserIdNotList.size() > 0">
${_conditionType_} a.updateUserId not in ${_conditionType_} a.updateUserId not in
<foreach collection="conditionParamRef.updateUserIdNotList" open="(" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.updateUserIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item} #{item}
...@@ -796,18 +834,186 @@ ...@@ -796,18 +834,186 @@
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''"> <if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if> </if>
<if test="conditionParamRef.containsKey('excuteTime')">
<if test="conditionParamRef.excuteTime != null ">
${_conditionType_} a.excuteTime = #{${_conditionParam_}.excuteTime}
</if>
<if test="conditionParamRef.excuteTime == null">
${_conditionType_} a.excuteTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('excuteTimeStart') and conditionParamRef.excuteTimeStart != null and conditionParamRef.excuteTimeStart!=''">
${_conditionType_} a.excuteTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.excuteTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('excuteTimeEnd') and conditionParamRef.excuteTimeEnd != null and conditionParamRef.excuteTimeEnd!=''">
${_conditionType_} a.excuteTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.excuteTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('staffType')">
<if test="conditionParamRef.staffType != null ">
${_conditionType_} a.staffType = #{${_conditionParam_}.staffType}
</if>
<if test="conditionParamRef.staffType == null">
${_conditionType_} a.staffType is null
</if>
</if>
<if test="conditionParamRef.containsKey('staffTypeList') and conditionParamRef.staffTypeList.size() > 0">
${_conditionType_} a.staffType in
<foreach collection="conditionParamRef.staffTypeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('staffTypeNotList') and conditionParamRef.staffTypeNotList.size() > 0">
${_conditionType_} a.staffType not in
<foreach collection="conditionParamRef.staffTypeNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('staffTypeStart') and conditionParamRef.staffTypeStart != null">
${_conditionType_} a.staffType <![CDATA[ >= ]]> #{${_conditionParam_}.staffTypeStart}
</if>
<if test="conditionParamRef.containsKey('staffTypeEnd') and conditionParamRef.staffTypeEnd != null">
${_conditionType_} a.staffType <![CDATA[ <= ]]> #{${_conditionParam_}.staffTypeEnd}
</if>
</sql> </sql>
<sql id="_orderCols_"> <sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()"> <if test="orderColList != null and !orderColList.isEmpty()">
order by order by
<if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
field(a.id,
<foreach collection="conditionParamRef.idList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('staffIdList') and conditionParamRef.staffIdList.size() > 0">
field(a.staffId,
<foreach collection="conditionParamRef.staffIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('deptIdList') and conditionParamRef.deptIdList.size() > 0">
field(a.deptId,
<foreach collection="conditionParamRef.deptIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('jobIdList') and conditionParamRef.jobIdList.size() > 0">
field(a.jobId,
<foreach collection="conditionParamRef.jobIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('careTypeList') and conditionParamRef.careTypeList.size() > 0">
field(a.careType,
<foreach collection="conditionParamRef.careTypeList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('sendStatusList') and conditionParamRef.sendStatusList.size() > 0">
field(a.sendStatus,
<foreach collection="conditionParamRef.sendStatusList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
field(a.createUserId,
<foreach collection="conditionParamRef.createUserIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('updateUserIdList') and conditionParamRef.updateUserIdList.size() > 0">
field(a.updateUserId,
<foreach collection="conditionParamRef.updateUserIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('staffTypeList') and conditionParamRef.staffTypeList.size() > 0">
field(a.staffType,
<foreach collection="conditionParamRef.staffTypeList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<trim suffixOverrides="," suffix=""> <trim suffixOverrides="," suffix="">
<foreach collection="orderColList" open="" close="" index="index" item="item" separator=","> <foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
${item.colName} ${item.sortKind} a.${item.colName} ${item.sortKind}
</foreach> </foreach>
</trim> </trim>
</if> </if>
<if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()"> <if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
order by order by
<if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
field(a.id,
<foreach collection="conditionParamRef.idList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('staffIdList') and conditionParamRef.staffIdList.size() > 0">
field(a.staffId,
<foreach collection="conditionParamRef.staffIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('deptIdList') and conditionParamRef.deptIdList.size() > 0">
field(a.deptId,
<foreach collection="conditionParamRef.deptIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('jobIdList') and conditionParamRef.jobIdList.size() > 0">
field(a.jobId,
<foreach collection="conditionParamRef.jobIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('careTypeList') and conditionParamRef.careTypeList.size() > 0">
field(a.careType,
<foreach collection="conditionParamRef.careTypeList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('sendStatusList') and conditionParamRef.sendStatusList.size() > 0">
field(a.sendStatus,
<foreach collection="conditionParamRef.sendStatusList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
field(a.createUserId,
<foreach collection="conditionParamRef.createUserIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('updateUserIdList') and conditionParamRef.updateUserIdList.size() > 0">
field(a.updateUserId,
<foreach collection="conditionParamRef.updateUserIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('staffTypeList') and conditionParamRef.staffTypeList.size() > 0">
field(a.staffType,
<foreach collection="conditionParamRef.staffTypeList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<trim suffixOverrides="," suffix=""> <trim suffixOverrides="," suffix="">
<if test="orderCol.containsKey('id')"> <if test="orderCol.containsKey('id')">
a.id a.id
...@@ -889,8 +1095,20 @@ ...@@ -889,8 +1095,20 @@
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if> <if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('excuteTime')">
a.excuteTime
<if test='orderCol.excuteTime != null and "DESC".equalsIgnoreCase(orderCol.excuteTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('staffType')">
a.staffType
<if test='orderCol.staffType != null and "DESC".equalsIgnoreCase(orderCol.staffType)'>DESC</if>
,
</if>
</trim> </trim>
</if> </if>
</sql> </sql>
<sql id="_group_by_"> <sql id="_group_by_">
<if test="groupList != null and !groupList.isEmpty()"> <if test="groupList != null and !groupList.isEmpty()">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.staff.dao.ibatis.StaffCareDaoImpl">
<!-- 获取列表 -->
<select id="getStaffCareList" parameterType="com.mortals.xhx.module.staff.model.StaffCareEntity" resultMap="StaffCareEntity-Map">
select <include refid="_columns"/>
from mortals_xhx_staff_care as a
where 1=1
<if test="careType != null and careType ==1">
and MONTH(birthday) = #{month}
<if test="day != null">
and DAY(birthday) = #{day}
</if>
</if>
<if test="careType != null and careType ==2">
and MONTH(entryDate) = #{month}
<if test="day != null">
and DAY(entryDate) = #{day}
</if>
</if>
</select>
<!-- 获取 -->
<select id="getStaffCareListCount" parameterType="com.mortals.xhx.module.staff.model.StaffCareEntity" resultType="int">
select count(1)
from mortals_xhx_staff_care as a
where 1=1
<if test="careType != null and careType ==1">
and MONTH(birthday) = #{month}
<if test="day != null">
and DAY(birthday) = #{day}
</if>
</if>
<if test="careType != null and careType ==2">
and MONTH(entryDate) = #{month}
<if test="day != null">
and DAY(entryDate) = #{day}
</if>
</if>
</select>
<update id="initSendStatus">
update mortals_xhx_staff_care as a set sendStatus = 0
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment