职等职级 实体类 查询接口
parent
1bb99c5729
commit
40f3585310
@ -0,0 +1,27 @@
|
||||
package com.engine.organization.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 薪资公式计算器-变量
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface OrganizationFormulaVar {
|
||||
|
||||
int labelId();
|
||||
|
||||
String defaultLabel();
|
||||
|
||||
String dataType();
|
||||
|
||||
String fieldId() default "";
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.engine.organization.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 数据列表表头
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface OrganizationTableColumn {
|
||||
|
||||
String text() default "";
|
||||
|
||||
int labelId() default -1;
|
||||
|
||||
String width() default "";
|
||||
|
||||
String column() default "";
|
||||
|
||||
boolean display() default true;
|
||||
|
||||
String orderkey() default "";
|
||||
|
||||
String transmethod() default "";
|
||||
|
||||
// 额外参数
|
||||
String otherPara() default "";
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.engine.organization.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 列表操作按钮
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Target({ElementType.ANNOTATION_TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface OrganizationTableOperate {
|
||||
|
||||
String text() default "";
|
||||
|
||||
int labelId() default -1;
|
||||
|
||||
String href() default "";
|
||||
|
||||
String index() default "0";
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.engine.organization.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface TableTitle {
|
||||
String title();
|
||||
String dataIndex();
|
||||
String key();
|
||||
boolean display() default true;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.engine.organization.biz;
|
||||
|
||||
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
import com.engine.organization.mapper.scheme.SchemeMapper;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
import com.engine.organization.util.page.PageUtil;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import weaver.conn.mybatis.MyBatisFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SchemeBiz {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.engine.organization.cmd.scheme;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.scheme.vo.SchemeTableVO;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*查询职等职级列表
|
||||
*/
|
||||
public class SchemeListCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public SchemeListCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
OrganizationWeaTable<SchemeTableVO> table = new OrganizationWeaTable<>(user,SchemeTableVO.class);
|
||||
|
||||
String sqlWhere = buildSqlWhere(params);
|
||||
table.setSqlwhere(sqlWhere);
|
||||
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
return result.getResultMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
private String buildSqlWhere(Map<String, Object> params) {
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
String sqlWhere = " where delete_type ='0' ";
|
||||
String name = (String) params.get("name");
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
sqlWhere += " AND scheme_name " + dbType.like(name);
|
||||
}
|
||||
String no = (String) params.get("no");
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
sqlWhere += " AND scheme_no " + dbType.like(no);
|
||||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.engine.organization.cmd.scheme;
|
||||
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
import com.engine.organization.exception.OrganizationRunTimeException;
|
||||
import com.engine.organization.mapper.scheme.SchemeMapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import weaver.conn.mybatis.MyBatisFactory;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SchemeSaveCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public SchemeSaveCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>(16);
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SchemeMapper mapper = sqlSession.getMapper(SchemeMapper.class);
|
||||
|
||||
List<SchemePO> list = mapper.listByNo(Util.null2String(this.params.get("scheme_no")));
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
throw new OrganizationRunTimeException("编号不允许重复");
|
||||
}
|
||||
|
||||
SchemePO schemePO = SchemePO.convertToPO(params, (long) user.getUID());
|
||||
mapper.insertIgnoreNull(schemePO);
|
||||
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.engine.organization.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description: TODO 基础查询参数
|
||||
* @Date 2022/3/17
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BaseQueryParam {
|
||||
//当前页码
|
||||
private Integer current = 1;
|
||||
|
||||
//每页数据条数
|
||||
private Integer pageSize = 10;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.engine.organization.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 日期范围
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LocalDateRange {
|
||||
|
||||
//"开始日期
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date fromDate;
|
||||
|
||||
//结束日期
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date endDate;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package com.engine.organization.component;
|
||||
|
||||
import com.cloudstore.eccom.constant.WeaBoolAttr;
|
||||
import com.cloudstore.eccom.pc.table.*;
|
||||
import com.engine.organization.annotation.OrganizationTable;
|
||||
import com.engine.organization.annotation.OrganizationTableColumn;
|
||||
import com.engine.organization.annotation.OrganizationTableOperate;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.general.PageIdConst;
|
||||
import weaver.hrm.User;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class OrganizationWeaTable<T> extends WeaTable {
|
||||
|
||||
public OrganizationWeaTable(User user, Class clazz) {
|
||||
|
||||
boolean isAnno = clazz.isAnnotationPresent(OrganizationTable.class);
|
||||
if (isAnno) {
|
||||
OrganizationTable table = (OrganizationTable) clazz.getAnnotation(OrganizationTable.class);
|
||||
String pageId = table.pageId();
|
||||
super.setPageID(pageId);
|
||||
String pageUid = pageId + "_" + user.getUID();
|
||||
super.setPageUID(pageUid);
|
||||
String pageSize = PageIdConst.getPageSize(pageId, user.getUID());
|
||||
super.setPagesize(pageSize);
|
||||
String backfields = table.fields();
|
||||
super.setBackfields(backfields);
|
||||
String sql = table.fromSql();
|
||||
super.setSqlform(sql);
|
||||
String where = table.where();
|
||||
if (StringUtils.isNotBlank(where)) {
|
||||
super.setSqlwhere(where);
|
||||
}
|
||||
String orderby = table.orderby();
|
||||
if (StringUtils.isNotBlank(orderby)) {
|
||||
super.setSqlorderby(orderby);
|
||||
}
|
||||
String groupby = table.groupby();
|
||||
if (StringUtils.isNotBlank(groupby)) {
|
||||
super.setSqlgroupby(groupby);
|
||||
}
|
||||
boolean distinct = table.distinct();
|
||||
super.setSqlisdistinct(String.valueOf(distinct));
|
||||
String primarykey = table.primarykey();
|
||||
if (StringUtils.isNotBlank(primarykey)) {
|
||||
super.setSqlprimarykey(primarykey);
|
||||
}
|
||||
OrganizationTableOperate[] operates = table.operates();
|
||||
if (operates != null && operates.length > 0) {
|
||||
List<WeaTableOperate> operateList = new ArrayList<>();
|
||||
Arrays.stream(operates).forEach(o -> {
|
||||
String text = o.text();
|
||||
int labelId = o.labelId();
|
||||
String htmlLabelName = SystemEnv.getHtmlLabelName(labelId, user.getLanguage());
|
||||
if (StringUtils.isNotBlank(htmlLabelName)) {
|
||||
text = htmlLabelName;
|
||||
}
|
||||
WeaTableOperate weaTableOperate = new WeaTableOperate(text, o.href(), o.index());
|
||||
operateList.add(weaTableOperate);
|
||||
});
|
||||
WeaTableOperates weaTableOperates = new WeaTableOperates();
|
||||
weaTableOperates.setOperate(operateList);
|
||||
super.setOperates(weaTableOperates);
|
||||
}
|
||||
|
||||
WeaTableType weaTableTypeEnum = table.tableType();
|
||||
//设置check是否可用
|
||||
if (weaTableTypeEnum == WeaTableType.CHECKBOX) {
|
||||
super.setTableType(weaTableTypeEnum);
|
||||
// WeaTableCheckboxpopedom checkboxpopedom = new WeaTableCheckboxpopedom();
|
||||
// checkboxpopedom.setShowmethod("true");
|
||||
// super.setCheckboxpopedom(checkboxpopedom);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field f : fields) {
|
||||
boolean isanno = f.isAnnotationPresent(OrganizationTableColumn.class);
|
||||
if (isanno) {
|
||||
OrganizationTableColumn columnAnn = f.getAnnotation(OrganizationTableColumn.class);
|
||||
String text = columnAnn.text();
|
||||
int labelId = columnAnn.labelId();
|
||||
String htmlLabelName = SystemEnv.getHtmlLabelName(labelId, user.getLanguage());
|
||||
if (StringUtils.isNotBlank(htmlLabelName)) {
|
||||
text = htmlLabelName;
|
||||
}
|
||||
String width = columnAnn.width();
|
||||
String column = columnAnn.column();
|
||||
String orderkey = columnAnn.orderkey();
|
||||
boolean display = columnAnn.display();
|
||||
WeaTableColumn weaTableColumn = new WeaTableColumn(width, text, column, orderkey);
|
||||
String transmethod = columnAnn.transmethod();
|
||||
|
||||
if (StringUtils.isNotBlank(transmethod)) {
|
||||
weaTableColumn.setTransmethod(transmethod);
|
||||
}
|
||||
String otherPara = columnAnn.otherPara();
|
||||
if(StringUtils.isNotBlank(otherPara)) {
|
||||
weaTableColumn.setOtherpara(otherPara);
|
||||
}
|
||||
if (!display) {
|
||||
weaTableColumn.setDisplay(WeaBoolAttr.FALSE);
|
||||
}
|
||||
super.getColumns().add(weaTableColumn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.engine.organization.entity.scheme.bo;
|
||||
|
||||
import com.engine.organization.entity.scheme.dto.SchemeListDTO;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SchemeBO {
|
||||
|
||||
public static List<SchemeListDTO> convert2ListDTO(Collection<SchemePO> schemes) {
|
||||
if (CollectionUtils.isEmpty(schemes)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return schemes.stream().map(schemePO -> {
|
||||
return SchemeListDTO.builder()
|
||||
.id(schemePO.getId())
|
||||
.schemeNo(schemePO.getSchemeNo())
|
||||
.schemeName(schemePO.getSchemeName())
|
||||
.schemeDescription(schemePO.getSchemeDescription())
|
||||
.forbiddenTag(schemePO.getForbiddenTag())
|
||||
.build();
|
||||
}
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.engine.organization.entity.scheme.dto;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.engine.organization.annotation.OrganizationTable;
|
||||
import com.engine.organization.annotation.OrganizationTableColumn;
|
||||
import com.engine.organization.annotation.OrganizationTableOperate;
|
||||
import com.engine.organization.annotation.TableTitle;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@OrganizationTable(pageId = "1594a04a-cced-11ec-a15f-00ffcbed7508", tableType = WeaTableType.CHECKBOX, operates = {@OrganizationTableOperate(text = "编辑", index = "0"), @OrganizationTableOperate(text = "删除", index = "1")})
|
||||
public class SchemeListDTO {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@OrganizationTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
@OrganizationTableColumn(text = "编号", width = "25%", column = "schemeNo")
|
||||
@TableTitle(title = "编号",dataIndex = "schemeNo",key = "schemeNo")
|
||||
private String schemeNo;
|
||||
|
||||
@OrganizationTableColumn(text = "方案名称", width = "25%", column = "schemeName")
|
||||
@TableTitle(title = "方案名称",dataIndex = "schemeName",key = "schemeName")
|
||||
private String schemeName;
|
||||
|
||||
//薪资档案引用
|
||||
@OrganizationTableColumn(text = "方案说明", width = "25%", column = "schemeDescription")
|
||||
@TableTitle(title = "方案说明",dataIndex = "schemeDescription",key = "schemeDescription")
|
||||
private String schemeDescription;
|
||||
|
||||
//默认使用
|
||||
@OrganizationTableColumn(text = "禁用标记", width = "25%", column = "forbiddenTag")
|
||||
@TableTitle(title = "禁用标记",dataIndex = "forbiddenTag",key = "forbiddenTag")
|
||||
private Integer forbiddenTag;
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.engine.organization.entity.scheme.param;
|
||||
|
||||
import com.engine.organization.common.BaseQueryParam;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
/**
|
||||
* 薪资项目查询参数
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SchemeSearchParam extends BaseQueryParam {
|
||||
|
||||
//名称
|
||||
private String schemeNo;
|
||||
|
||||
//备注
|
||||
private String schemeName;
|
||||
|
||||
private String schemeDescription;
|
||||
|
||||
private Integer forbiddenTag;
|
||||
|
||||
|
||||
|
||||
public static String makeSqlWhere(SchemeSearchParam searchParam) {
|
||||
|
||||
String sqlWhere = " 1 = 1 ";
|
||||
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
|
||||
String schemeNo = searchParam.getSchemeNo();
|
||||
if (StringUtils.isNotBlank(schemeNo)) {
|
||||
sqlWhere += " AND t.scheme_no " + dbType.like(schemeNo);
|
||||
}
|
||||
String schemeName = searchParam.getSchemeName();
|
||||
if (StringUtils.isNotBlank(schemeName)) {
|
||||
sqlWhere += " AND t.scheme_name " + dbType.like(schemeName);
|
||||
}
|
||||
String schemeDescription = searchParam.getSchemeDescription();
|
||||
if (schemeDescription != null) {
|
||||
sqlWhere += " AND t.scheme_description = " + schemeDescription;
|
||||
}
|
||||
Integer forbiddenTag = searchParam.getForbiddenTag();
|
||||
if (forbiddenTag != null) {
|
||||
sqlWhere += " AND t.forbidden_tag = " + forbiddenTag;
|
||||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.engine.organization.entity.scheme.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SchemePO {
|
||||
/**
|
||||
*自增主键
|
||||
*/
|
||||
private long id;
|
||||
/**
|
||||
*编号
|
||||
*/
|
||||
private String schemeNo;
|
||||
/**
|
||||
*方案名称
|
||||
*/
|
||||
private String schemeName;
|
||||
/**
|
||||
*方案说明
|
||||
*/
|
||||
private String schemeDescription;
|
||||
/**
|
||||
*禁用标记
|
||||
*/
|
||||
private int forbiddenTag;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long creator;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private int deleteType;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
public static SchemePO convertToPO(Map<String, Object> param, Long employeeId) {
|
||||
if (param == null) {
|
||||
return null;
|
||||
}
|
||||
return SchemePO.builder()
|
||||
.id(param.get("id") == null ? null : (long) param.get("id"))
|
||||
.schemeNo(param.get("scheme_no") == null ? null : (String) param.get("scheme_no"))
|
||||
.schemeName(param.get("scheme_name") == null ? null : (String) param.get("scheme_name"))
|
||||
.schemeDescription(param.get("scheme_description") == null ? null : (String) param.get("descrscheme_descriptioniption"))
|
||||
.forbiddenTag(param.get("forbidden_tag") == null ? null : (int) param.get("forbidden_tag"))
|
||||
.deleteType(0)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.creator(employeeId)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.engine.organization.entity.scheme.vo;
|
||||
|
||||
import com.engine.organization.annotation.OrganizationTable;
|
||||
import com.engine.organization.annotation.OrganizationTableColumn;
|
||||
import com.engine.organization.annotation.OrganizationTableOperate;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description: TODO
|
||||
* @Date 2022/3/10
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@OrganizationTable(pageId = "98e9c62f-cd12-11ec-a15f-00ffcbed7508",
|
||||
fields = "t.id," +
|
||||
"t.scheme_no," +
|
||||
"t.scheme_name," +
|
||||
"t.scheme_description," +
|
||||
"t.forbidden_tag," +
|
||||
"t.creator," +
|
||||
"t.delete_type," +
|
||||
"t.create_time," +
|
||||
"t.update_time",
|
||||
fromSql = "FROM jcl_org_scheme t ",
|
||||
orderby = "id desc",
|
||||
primarykey = "id",
|
||||
operates = {
|
||||
@OrganizationTableOperate(index = "0", text = "编辑"),
|
||||
@OrganizationTableOperate(index = "1", text = "复制")
|
||||
}
|
||||
)
|
||||
public class SchemeTableVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@OrganizationTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
@OrganizationTableColumn(text = "编号", width = "25%", column = "scheme_no")
|
||||
private String schemeNo;
|
||||
/**
|
||||
* 方案名称
|
||||
*/
|
||||
@OrganizationTableColumn(text = "方案名称", width = "25%", column = "scheme_name")
|
||||
private String schemeName;
|
||||
|
||||
//薪资档案引用
|
||||
@OrganizationTableColumn(text = "方案说明", width = "25%", column = "scheme_description")
|
||||
private String schemeDescription;
|
||||
|
||||
//默认使用
|
||||
@OrganizationTableColumn(text = "禁用标记", width = "25%", column = "forbidden_tag")
|
||||
private Integer forbiddenTag;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.engine.organization.mapper.scheme;
|
||||
|
||||
|
||||
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description: TODO
|
||||
* @Date 2022/3/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public interface SchemeMapper {
|
||||
|
||||
|
||||
@Select("select * from jcl_org_scheme t where scheme_no = #{schemeNo}")
|
||||
List<SchemePO> listByNo(String schemeNo);
|
||||
|
||||
int insertIgnoreNull(SchemePO schemePO);
|
||||
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.engine.organization.mapper.scheme.SchemeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.organization.entity.scheme.po.SchemePO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="scheme_no" property="schemeNo"/>
|
||||
<result column="scheme_name" property="schemeName"/>
|
||||
<result column="scheme_description" property="schemeDescription"/>
|
||||
<result column="forbidden_tag" property="forbiddenTag"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="delete_type" property="deleteType"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t
|
||||
.
|
||||
id
|
||||
, t.scheme_no
|
||||
, t.scheme_name
|
||||
, t.scheme_description
|
||||
, t.forbidden_tag
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
</sql>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.scheme.po.SchemePO" keyProperty="id"
|
||||
keyColumn="id" useGeneratedKeys="true">
|
||||
INSERT INTO jcl_org_scheme
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="id != null ">
|
||||
id,
|
||||
</if>
|
||||
<if test="schemeNo != null ">
|
||||
scheme_no,
|
||||
</if>
|
||||
<if test="schemeName != null ">
|
||||
scheme_name,
|
||||
</if>
|
||||
<if test="schemeDescription != null ">
|
||||
scheme_description,
|
||||
</if>
|
||||
<if test="forbiddenTag != null ">
|
||||
forbidden_tag,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="id != null ">
|
||||
#{id},
|
||||
</if>
|
||||
<if test="schemeNo != null ">
|
||||
#{scheme_no},
|
||||
</if>
|
||||
<if test="schemeName != null ">
|
||||
#{scheme_name},
|
||||
</if>
|
||||
<if test="schemeDescription != null ">
|
||||
#{scheme_description},
|
||||
</if>
|
||||
<if test="forbiddenTag != null ">
|
||||
#{forbidden_tag},
|
||||
</if>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,23 @@
|
||||
package com.engine.organization.service;
|
||||
|
||||
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description: TODO
|
||||
* @Date 2022/4/27
|
||||
* @Version V1.0
|
||||
**/
|
||||
public interface SchemeService {
|
||||
|
||||
Map<String, Object> save(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> listPage(Map<String, Object> params);
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.biz.SchemeBiz;
|
||||
import com.engine.organization.cmd.scheme.SchemeListCmd;
|
||||
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
import com.engine.organization.service.SchemeService;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
import com.weaverboot.frame.ioc.anno.classAnno.WeaIocService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description: TODO
|
||||
* @Date 2022/4/27
|
||||
* @Version V1.0
|
||||
**/
|
||||
@WeaIocService
|
||||
public class SchemeServiceImpl extends Service implements SchemeService {
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> save(Map<String, Object> params) {
|
||||
return commandExecutor.execute(new SchemeListCmd(params, user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(Map<String, Object> params) {
|
||||
return commandExecutor.execute(new SchemeListCmd(params,user));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.engine.organization.util.db;
|
||||
|
||||
public interface DBOperateAdapter {
|
||||
String like(String some);
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.engine.organization.util.db;
|
||||
|
||||
|
||||
import com.engine.organization.exception.OrganizationRunTimeException;
|
||||
|
||||
public enum DBType implements DBOperateAdapter {
|
||||
MYSQL("mysql") {
|
||||
@Override
|
||||
public String like(String some) {
|
||||
return "like '%" + some + "%'";
|
||||
}
|
||||
},
|
||||
SQLSERVER("sqlserver") {
|
||||
@Override
|
||||
public String like(String some) {
|
||||
return "like '%" + some + "%'";
|
||||
}
|
||||
},
|
||||
ORACLE("oracle") {
|
||||
@Override
|
||||
public String like(String some) {
|
||||
return "'%'||" + some + "||'%'";
|
||||
}
|
||||
};
|
||||
|
||||
private String dbtype;
|
||||
|
||||
DBType(String dbtype) {
|
||||
this.dbtype = dbtype;
|
||||
}
|
||||
|
||||
public static DBType get(String dbtype) {
|
||||
for (DBType t : DBType.values()) {
|
||||
if (t.dbtype.equalsIgnoreCase(dbtype)) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
throw new OrganizationRunTimeException("不支持的数据库类型");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.engine.organization.util.page;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Column {
|
||||
String title;
|
||||
String dataIndex;
|
||||
String key;
|
||||
boolean display;
|
||||
|
||||
public Column(String title, String dataIndex, String key) {
|
||||
this.title = title;
|
||||
this.dataIndex = dataIndex;
|
||||
this.key = key;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.engine.organization.util.page;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DataSource {
|
||||
String key;
|
||||
String title;
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.engine.organization.util.page;
|
||||
|
||||
import com.engine.organization.annotation.TableTitle;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class PageInfo<T> extends com.github.pagehelper.PageInfo<T> {
|
||||
Class<T> clazz;
|
||||
|
||||
public void setColumns(List<Column> columns) {
|
||||
this.columns.addAll(columns);
|
||||
}
|
||||
|
||||
List<Column> columns = new ArrayList<>();
|
||||
List<DataSource> dataSource = new ArrayList<>();
|
||||
|
||||
public PageInfo() {
|
||||
}
|
||||
|
||||
public PageInfo(Class<T> clazz) {
|
||||
this.clazz = clazz;
|
||||
this.columns = buildColumns();
|
||||
}
|
||||
|
||||
public PageInfo(List<T> list) {
|
||||
super(list);
|
||||
}
|
||||
|
||||
public PageInfo(List<T> list, Class<T> clazz) {
|
||||
super(list);
|
||||
this.clazz = clazz;
|
||||
this.columns = buildColumns();
|
||||
}
|
||||
|
||||
|
||||
public List<Column> buildColumns() {
|
||||
if(clazz==null){
|
||||
return this.columns;
|
||||
}
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field f : fields) {
|
||||
boolean isanno = f.isAnnotationPresent(TableTitle.class);
|
||||
if (isanno) {
|
||||
TableTitle annotation = f.getAnnotation(TableTitle.class);
|
||||
String title = annotation.title();
|
||||
String dataIndex = annotation.dataIndex();
|
||||
String key = annotation.key();
|
||||
boolean display = annotation.display();
|
||||
Column column = Column.builder().title(title).dataIndex(dataIndex).key(key).display(display).build();
|
||||
columns.add(column);
|
||||
}
|
||||
}
|
||||
return columns;
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.engine.organization.web;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.scheme.dto.SchemeListDTO;
|
||||
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
|
||||
import com.engine.organization.service.SchemeService;
|
||||
import com.engine.organization.service.impl.SchemeServiceImpl;
|
||||
import com.engine.organization.util.ResponseResult;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.SchemeWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
public class SchemeController {
|
||||
|
||||
private SchemeService getSchemeService(User user) {
|
||||
return ServiceUtil.getService(SchemeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public SchemeWrapper getSchemeWrapper(User user) {
|
||||
return ServiceUtil.getService(SchemeWrapper.class, user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取list列表
|
||||
* @param request
|
||||
* @param response
|
||||
* @param searchCondition
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getTable")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getTable(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@QueryParam("searchCondition") String searchCondition) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ResponseResult.run(getSchemeService(user)::listPage, map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加职等职级信息
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String saveFrom(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ResponseResult.run(getSchemeService(user)::save, ParamUtil.request2Map(request));
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.engine.organization.wrapper;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.scheme.bo.SchemeBO;
|
||||
import com.engine.organization.entity.scheme.dto.SchemeListDTO;
|
||||
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
import com.engine.organization.service.SchemeService;
|
||||
import com.engine.organization.service.impl.SchemeServiceImpl;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description: TODO
|
||||
* @Date 2022/4/26
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class SchemeWrapper extends Service {
|
||||
|
||||
private SchemeService getSchemeService(User user) {
|
||||
return ServiceUtil.getService(SchemeServiceImpl.class,user);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue