等级方案 接口优化
This commit is contained in:
parent
7eefb4c928
commit
2f282aa5c4
|
|
@ -1,27 +0,0 @@
|
|||
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 "";
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
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,36 @@
|
|||
package com.engine.organization.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import weaver.general.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author dxfeng
|
||||
* @Description: TODO
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class QueryParam {
|
||||
private String ids;
|
||||
|
||||
public Collection<Long> getIds() {
|
||||
if(StringUtil.isEmpty(ids)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Long> collect = Arrays.stream(ids.split(",")).map(item -> Long.parseLong(item)).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.engine.organization.entity.scheme.dto;
|
||||
|
||||
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
/**
|
||||
* @Author dxfeng
|
||||
* @Description: TODO
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SchemeDTO {
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
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 ? 0 : Integer.parseInt((String) 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 ? 0 : Integer.parseInt((String) param.get("forbidden_tag")))
|
||||
.deleteType(0)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.creator(employeeId)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static SchemePO convertParamToPO(SchemeSearchParam param, Long employeeId) {
|
||||
if (param == null) {
|
||||
return null;
|
||||
}
|
||||
return SchemePO.builder()
|
||||
.id(param.getId() == null ? 0 : param.getId())
|
||||
.schemeNo(param.getSchemeNo() == null ? null : param.getSchemeNo())
|
||||
.schemeName(param.getSchemeName() == null ? null : param.getSchemeName())
|
||||
.schemeDescription(param.getSchemeDescription() == null ? null : param.getSchemeDescription())
|
||||
.forbiddenTag(param.getForbiddenTag() == null ? 0 : param.getForbiddenTag() ? 1 : 0)
|
||||
.deleteType(0)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.creator(employeeId)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,34 +1,41 @@
|
|||
package com.engine.organization.entity.scheme.param;
|
||||
|
||||
import com.engine.organization.common.BaseQueryParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 薪资项目查询参数
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
* @Author dxfeng
|
||||
* @Description: TODO
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SchemeSearchParam extends BaseQueryParam {
|
||||
public class SchemeSearchParam {
|
||||
|
||||
private Long id;
|
||||
//名称
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String schemeNo;
|
||||
|
||||
//备注
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String schemeName;
|
||||
|
||||
/**
|
||||
* 方案说明
|
||||
*/
|
||||
private String schemeDescription;
|
||||
|
||||
private Integer forbiddenTag;
|
||||
/**
|
||||
* 禁用标记
|
||||
*/
|
||||
private Boolean forbiddenTag;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
package com.engine.organization.entity.scheme.po;
|
||||
|
||||
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
|
|
@ -51,38 +49,4 @@ public class SchemePO {
|
|||
*/
|
||||
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 ? 0 : Integer.parseInt((String)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 ? 0 : Integer.parseInt((String)param.get("forbidden_tag")))
|
||||
.deleteType(0)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.creator(employeeId)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static SchemePO convertParamToPO(SchemeSearchParam param, Long employeeId) {
|
||||
if (param == null) {
|
||||
return null;
|
||||
}
|
||||
return SchemePO.builder()
|
||||
.id(param.getId() == null ? 0 : param.getId())
|
||||
.schemeNo(param.getSchemeNo() == null ? null : param.getSchemeNo())
|
||||
.schemeName(param.getSchemeName() == null ? null : param.getSchemeName())
|
||||
.schemeDescription(param.getSchemeDescription() == null ? null : param.getSchemeDescription())
|
||||
.forbiddenTag(param.getForbiddenTag() == null ? 0 : param.getForbiddenTag())
|
||||
.deleteType(0)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.creator(employeeId)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,31 +9,43 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Author dxfeng
|
||||
* @Description: TODO
|
||||
* @Date 2022/3/9
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public interface SchemeMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID查询登记方案
|
||||
* 根据No查询登记方案
|
||||
*
|
||||
* @param schemeNo
|
||||
* @return
|
||||
*/
|
||||
@Select("select * from jcl_org_scheme t where scheme_no = #{schemeNo}")
|
||||
@Select("select * from jcl_org_scheme t where scheme_no = #{schemeNo} AND delete_type = 0")
|
||||
List<SchemePO> listByNo(String schemeNo);
|
||||
|
||||
/**
|
||||
* 根据ID查询登记方案
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Select("select * from jcl_org_scheme t where id = #{id} AND delete_type = 0")
|
||||
SchemePO getSchemeByID(@Param("id") long id);
|
||||
|
||||
/**
|
||||
* 根据ID查询登记方案列表
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<SchemePO> listSchemesById(@Param("ids") Collection<Long> ids);
|
||||
List<SchemePO> listSchemesByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 新增,忽略null字段
|
||||
*
|
||||
* @param schemePO
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -41,6 +53,7 @@ public interface SchemeMapper {
|
|||
|
||||
/**
|
||||
* 修改,修改所有字段
|
||||
*
|
||||
* @param schemePO
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -48,20 +61,12 @@ public interface SchemeMapper {
|
|||
|
||||
/**
|
||||
* 更新禁用标记
|
||||
*
|
||||
* @param schemePO
|
||||
* @return
|
||||
*/
|
||||
int updateForbiddenTagById(SchemePO schemePO);
|
||||
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param schemePO 待删除的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int deleteScheme(SchemePO schemePO);
|
||||
|
||||
/**
|
||||
* 批量删除登记方案
|
||||
*
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
, t.update_time
|
||||
</sql>
|
||||
|
||||
<select id="listSchemesById" parameterType="com.engine.organization.entity.scheme.po.SchemePO" resultMap="BaseResultMap">
|
||||
<select id="listSchemesByIds" parameterType="com.engine.organization.entity.scheme.po.SchemePO" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_scheme t
|
||||
|
|
@ -125,13 +125,6 @@
|
|||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<delete id="deleteScheme" parameterType="com.engine.organization.entity.scheme.po.SchemePO">
|
||||
UPDATE jcl_org_scheme
|
||||
SET delete_type=1
|
||||
WHERE id = #{id}
|
||||
AND delete_type = 0
|
||||
</delete>
|
||||
|
||||
<update id="deleteByIds">
|
||||
UPDATE jcl_org_scheme
|
||||
SET delete_type = 1
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
package com.engine.organization.service;
|
||||
|
||||
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Author dxfeng
|
||||
* @Description: TODO
|
||||
* @Date 2022/4/27
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public interface SchemeService {
|
||||
|
||||
/**
|
||||
* 等级方案列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -23,6 +23,7 @@ public interface SchemeService {
|
|||
|
||||
/**
|
||||
* 新增等级方案
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -30,6 +31,7 @@ public interface SchemeService {
|
|||
|
||||
/**
|
||||
* 更新等级方案信息
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -37,20 +39,33 @@ public interface SchemeService {
|
|||
|
||||
/**
|
||||
* 更新禁用标记
|
||||
*
|
||||
* @param params
|
||||
*/
|
||||
void updateForbiddenTagById(Map<String, Object> params);
|
||||
void updateForbiddenTagById(SchemeSearchParam params);
|
||||
|
||||
/**
|
||||
* 根据ID批量删除等级方案信息
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
void deleteByIds(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据ID删除当前登记方案数据
|
||||
* @param param
|
||||
* 获取搜索条件
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
void deleteScheme(SchemeSearchParam param);
|
||||
Map<String, Object> getSearchCondition(Map<String, Object> params);
|
||||
|
||||
|
||||
/**
|
||||
* 获取搜索条件
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getSchemeForm(Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,36 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.scheme.dto.SchemeDTO;
|
||||
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
|
||||
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||
import com.engine.organization.entity.scheme.vo.SchemeTableVO;
|
||||
import com.engine.organization.mapper.scheme.SchemeMapper;
|
||||
import com.engine.organization.service.SchemeService;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.weaverboot.frame.ioc.anno.classAnno.WeaIocService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Author dxfeng
|
||||
* @Description: TODO
|
||||
* @Date 2022/4/27
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
@WeaIocService
|
||||
|
||||
public class SchemeServiceImpl extends Service implements SchemeService {
|
||||
|
||||
@Override
|
||||
|
|
@ -49,7 +52,7 @@ public class SchemeServiceImpl extends Service implements SchemeService {
|
|||
SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class);
|
||||
List<SchemePO> list = mapper.listByNo(Util.null2String(param.getSchemeNo()));
|
||||
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
||||
SchemePO schemePO = SchemePO.convertParamToPO(param, (long) user.getUID());
|
||||
SchemePO schemePO = SchemeDTO.convertParamToPO(param, (long) user.getUID());
|
||||
mapper.insertIgnoreNull(schemePO);
|
||||
return apidatas;
|
||||
}
|
||||
|
|
@ -60,17 +63,15 @@ public class SchemeServiceImpl extends Service implements SchemeService {
|
|||
SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class);
|
||||
List<SchemePO> list = mapper.listByNo(Util.null2String(param.getSchemeNo()));
|
||||
OrganizationAssert.isEmpty(list, "当前编号已存在");
|
||||
SchemePO schemePO = SchemePO.convertParamToPO(param, (long) user.getUID());
|
||||
SchemePO schemePO = SchemeDTO.convertParamToPO(param, (long) user.getUID());
|
||||
mapper.updateScheme(schemePO);
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateForbiddenTagById(Map<String, Object> params) {
|
||||
public void updateForbiddenTagById(SchemeSearchParam params) {
|
||||
SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class);
|
||||
int id = Integer.parseInt((String) params.get("id"));
|
||||
boolean flag = (Boolean) params.get("forbidden_tag");
|
||||
SchemePO schemePO = SchemePO.builder().id(id).forbiddenTag(flag ? 1 : 0).build();
|
||||
SchemePO schemePO = SchemePO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 1 : 0).build();
|
||||
mapper.updateForbiddenTagById(schemePO);
|
||||
}
|
||||
|
||||
|
|
@ -79,16 +80,53 @@ public class SchemeServiceImpl extends Service implements SchemeService {
|
|||
public void deleteByIds(Collection<Long> ids) {
|
||||
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
|
||||
SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class);
|
||||
List<SchemePO> schemePOS = mapper.listSchemesById(ids);
|
||||
List<SchemePO> schemePOS = mapper.listSchemesByIds(ids);
|
||||
OrganizationAssert.notEmpty(schemePOS, "选择的数据不存在,或数据已删除");
|
||||
mapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteScheme(SchemeSearchParam param) {
|
||||
SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class);
|
||||
SchemePO schemePO = SchemePO.convertParamToPO(param, (long) user.getUID());
|
||||
mapper.deleteScheme(schemePO);
|
||||
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
SearchConditionItem schemeNameCondition = OrganizationFormItemUtil.inputItem(user, "", 2, 16, 3, 50, "方案名称", "schemeName");
|
||||
SearchConditionItem schemeNoCondition = OrganizationFormItemUtil.inputItem(user, "", 2, 16, 3, 50, "方案编号", "schemeNo");
|
||||
conditionItems.add(schemeNameCondition);
|
||||
conditionItems.add(schemeNoCondition);
|
||||
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
|
||||
apiDatas.put("conditions", addGroups);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSchemeForm(Map<String, Object> params) {
|
||||
Map<String, Object> apiDatas = new HashMap<>();
|
||||
List<SearchConditionItem> selectItems = new ArrayList<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
SearchConditionItem schemeNameCondition = OrganizationFormItemUtil.inputItem(user, "required", 2, 16, 3, 50, "方案名称", "schemeName");
|
||||
SearchConditionItem schemeNoCondition = OrganizationFormItemUtil.inputItem(user, "required", 2, 16, 3, 50, "方案编号", "schemeNo");
|
||||
SearchConditionItem textareaItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 2, 60, "方案说明", "schemeDescription");
|
||||
|
||||
// 编辑状态下赋值操作
|
||||
String id = Util.null2String(params.get("locationid"));
|
||||
if (!StringUtil.isEmpty(id)) {
|
||||
SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class);
|
||||
SchemePO schemePO = mapper.getSchemeByID(Integer.parseInt(id));
|
||||
OrganizationAssert.notNull(schemePO, "选择的数据不存在,或数据已删除");
|
||||
schemeNameCondition.setValue(schemePO.getSchemeName());
|
||||
schemeNoCondition.setValue(schemePO.getSchemeNo());
|
||||
textareaItem.setValue(schemePO.getSchemeDescription());
|
||||
}
|
||||
|
||||
selectItems.add(schemeNameCondition);
|
||||
selectItems.add(schemeNoCondition);
|
||||
selectItems.add(textareaItem);
|
||||
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
|
||||
apiDatas.put("condition", addGroups);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,221 @@
|
|||
package com.engine.organization.util;
|
||||
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.ConditionType;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Author dxfeng
|
||||
* @Description: TODO
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class OrganizationFormItemUtil {
|
||||
|
||||
/**
|
||||
* 下拉框
|
||||
* @param user
|
||||
* @param selectOptions
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param labelcol
|
||||
* @param isQuickSearch
|
||||
* @param label
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem selectItem(User user, List<SearchConditionOption> selectOptions, int colSpan, int fieldcol,
|
||||
int labelcol, boolean isQuickSearch, String label,String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem select = conditionFactory.createCondition(ConditionType.SELECT,502327,name);
|
||||
select.setOptions(selectOptions);
|
||||
select.setColSpan(colSpan);
|
||||
select.setFieldcol(fieldcol);
|
||||
select.setLabelcol(labelcol);
|
||||
select.setIsQuickSearch(isQuickSearch);
|
||||
select.setLabel(label);
|
||||
return select;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* checkbox
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param viewAttr
|
||||
* @param isQuickSearch
|
||||
* @param label
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem checkboxItem(User user, int colSpan, int fieldcol,
|
||||
int viewAttr, boolean isQuickSearch, String label,String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem checkbox = conditionFactory.createCondition(ConditionType.CHECKBOX,502327,name);
|
||||
checkbox.setColSpan(colSpan);
|
||||
checkbox.setFieldcol(fieldcol);
|
||||
checkbox.setViewAttr(viewAttr);
|
||||
checkbox.setIsQuickSearch(isQuickSearch);
|
||||
checkbox.setLabel(label);
|
||||
return checkbox;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 输入框数字
|
||||
* @param user
|
||||
* @param rules
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param viewAttr
|
||||
* @param label
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem inputNumberItem(User user,String rules,int colSpan, int fieldcol,
|
||||
int viewAttr, String label,String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem inputnumber = conditionFactory.createCondition(ConditionType.INPUTNUMBER,502327, name);
|
||||
inputnumber.setColSpan(colSpan);
|
||||
inputnumber.setFieldcol(fieldcol);
|
||||
inputnumber.setViewAttr(viewAttr);
|
||||
inputnumber.setLabel(label);
|
||||
inputnumber.setRules(rules);
|
||||
|
||||
return inputnumber;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 输入框文本
|
||||
* @param user
|
||||
* @param rules
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param viewAttr
|
||||
* @param length
|
||||
* @param label
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem inputItem(User user,String rules,int colSpan, int fieldcol,
|
||||
int viewAttr,int length, String label,String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem input = conditionFactory.createCondition(ConditionType.INPUT,25034, name);
|
||||
input.setColSpan(colSpan);
|
||||
input.setFieldcol(fieldcol);
|
||||
input.setViewAttr(viewAttr);
|
||||
input.setLength(length);
|
||||
input.setLabel(label);
|
||||
input.setRules(rules);
|
||||
return input;
|
||||
}
|
||||
|
||||
/**
|
||||
* 浏览按钮
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param viewAttr
|
||||
* @param isQuickSearch
|
||||
* @param label
|
||||
* @param rules
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem browserItem(User user,int colSpan, int fieldcol,
|
||||
int viewAttr,boolean isQuickSearch,String label,String rules,String type,String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem browser = conditionFactory.createCondition(ConditionType.BROWSER,502327,name,type);
|
||||
browser.setColSpan(colSpan);
|
||||
browser.setFieldcol(fieldcol);
|
||||
browser.setViewAttr(viewAttr);
|
||||
browser.setIsQuickSearch(isQuickSearch);
|
||||
browser.setLabel(label);
|
||||
browser.setRules(rules);
|
||||
return browser;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 日期区间
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param viewAttr
|
||||
* @param label
|
||||
* @param rules
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem rangeDateItem(User user,int colSpan, int fieldcol,int viewAttr
|
||||
,String label,String rules,String name1,String name2) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem rangeDate = conditionFactory.createCondition(ConditionType.TIMEPICKER,502327,new String[]{name1,name2});
|
||||
rangeDate.setColSpan(colSpan);
|
||||
rangeDate.setFieldcol(fieldcol);
|
||||
rangeDate.setViewAttr(viewAttr);
|
||||
rangeDate.setLabel(label);
|
||||
rangeDate.setRules(rules);
|
||||
return rangeDate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 多行文本框
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param isQuickSearch
|
||||
* @param viewAttr
|
||||
* @param length
|
||||
* @param label
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem textareaItem(User user,int colSpan, int fieldcol,boolean isQuickSearch,
|
||||
int viewAttr,int length, String label,String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem textarea = conditionFactory.createCondition(ConditionType.TEXTAREA,502227, name);
|
||||
textarea.setColSpan(colSpan);
|
||||
textarea.setFieldcol(fieldcol);
|
||||
textarea.setIsQuickSearch(isQuickSearch);
|
||||
textarea.setViewAttr(viewAttr);
|
||||
textarea.setLength(length);
|
||||
textarea.setLabel(label);
|
||||
|
||||
return textarea;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 日期
|
||||
* @param user
|
||||
* @param colSpan
|
||||
* @param fieldcol
|
||||
* @param isQuickSearch
|
||||
* @param viewAttr
|
||||
* @param label
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static SearchConditionItem datePickerItem(User user,int colSpan, int fieldcol,boolean isQuickSearch,
|
||||
int viewAttr,String label,String name) {
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
SearchConditionItem datePicker = conditionFactory.createCondition(ConditionType.DATEPICKER,502227, name);
|
||||
datePicker.setColSpan(colSpan);
|
||||
datePicker.setFieldcol(fieldcol);
|
||||
datePicker.setIsQuickSearch(isQuickSearch);
|
||||
datePicker.setViewAttr(viewAttr);
|
||||
datePicker.setLabel(label);
|
||||
return datePicker;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.engine.organization.web;
|
|||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.QueryParam;
|
||||
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.SchemeWrapper;
|
||||
|
|
@ -17,9 +18,14 @@ import javax.ws.rs.Path;
|
|||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author dxfeng
|
||||
* @Description: TODO
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class SchemeController {
|
||||
|
||||
public SchemeWrapper getSchemeWrapper(User user) {
|
||||
|
|
@ -101,7 +107,7 @@ public class SchemeController {
|
|||
@POST
|
||||
@Path("/updateForbiddenTagById")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult updateForbiddenTagById(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map<String, Object> param) {
|
||||
public ReturnResult updateForbiddenTagById(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SchemeSearchParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
getSchemeWrapper(user).updateForbiddenTagById(param);
|
||||
|
|
@ -111,8 +117,9 @@ public class SchemeController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除单条数据
|
||||
* 根据ID批量删除数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
|
|
@ -120,34 +127,40 @@ public class SchemeController {
|
|||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/deleteScheme")
|
||||
@Path("/deleteByIds")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult deleteScheme(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SchemeSearchParam param) {
|
||||
public ReturnResult deleteByIds(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody QueryParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
getSchemeWrapper(user).deleteScheme(param);
|
||||
getSchemeWrapper(user).deleteByIds(param.getIds());
|
||||
return ReturnResult.successed();
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID批量删除数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/deleteByIds")
|
||||
@GET
|
||||
@Path("/getSearchCondition")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult deleteByIds(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
|
||||
public ReturnResult getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
getSchemeWrapper(user).deleteByIds(ids);
|
||||
return ReturnResult.successed();
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getSchemeWrapper(user).getSearchCondition(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/getSchemeForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getSchemeForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getSchemeWrapper(user).getSchemeForm(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import java.util.Collection;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Author dxfeng
|
||||
* @Description: TODO
|
||||
* @Date 2022/4/26
|
||||
* @Date 2022/5/9
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class SchemeWrapper extends Service {
|
||||
|
|
@ -55,9 +55,10 @@ public class SchemeWrapper extends Service {
|
|||
|
||||
/**
|
||||
* 更新禁用标记
|
||||
*
|
||||
* @param params
|
||||
*/
|
||||
public void updateForbiddenTagById(Map<String, Object> params) {
|
||||
public void updateForbiddenTagById(SchemeSearchParam params) {
|
||||
getSchemeService(user).updateForbiddenTagById(params);
|
||||
}
|
||||
|
||||
|
|
@ -70,12 +71,12 @@ public class SchemeWrapper extends Service {
|
|||
getSchemeService(user).deleteByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除当前登记方案数据
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
public void deleteScheme(SchemeSearchParam param) {
|
||||
getSchemeService(user).deleteScheme(param);
|
||||
|
||||
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
||||
return getSchemeService(user).getSearchCondition(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getSchemeForm(Map<String, Object> params) {
|
||||
return getSchemeService(user).getSchemeForm(params);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue