公司/分部BUG修复 编制方案接口

pull/23/MERGE^2
dxfeng 3 years ago
parent 3578a0f166
commit b212122007

@ -346,7 +346,7 @@ CREATE TABLE JCL_ORG_STAFFPLAN (
time_end date NULL,
company_id varchar(100) NULL,
description text NULL,
status int NULL,
forbidden_tag int NULL,
creator int null,
delete_type int null,
create_time date null,

@ -347,7 +347,7 @@ CREATE TABLE JCL_ORG_STAFFPLAN (
TIME_END DATE NULL,
COMPANY_ID NVARCHAR2(100) NULL,
DESCRIPTION NVARCHAR2(1000) NULL,
STATUS NUMBER NULL,
FORBIDDEN_TAG NUMBER NULL,
CREATOR NUMBER NULL,
DELETE_TYPE NUMBER NULL,
CREATE_TIME DATE NULL,

@ -346,7 +346,7 @@ CREATE TABLE JCL_ORG_STAFFPLAN (
time_end date NULL,
company_id varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
description text NULL,
status int NULL,
forbidden_tag int NULL,
creator int null,
delete_type int null,
create_time date null,

@ -0,0 +1,13 @@
package com.api.organization.web;
import javax.ws.rs.Path;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/25
* @version: 1.0
*/
@Path("/bs/hrmorganization/staffplan")
public class StaffPlanController extends com.engine.organization.web.StaffPlanController {
}

@ -0,0 +1,35 @@
package com.engine.organization.entity.staff.bo;
import com.engine.organization.entity.staff.param.StaffPlanSearchParam;
import com.engine.organization.entity.staff.po.StaffPlanPO;
import java.util.Date;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/25
* @version: 1.0
*/
public class StaffPlanBO {
public static StaffPlanPO convertParamToPO(StaffPlanSearchParam param, Long employeeId) {
if (param == null) {
return null;
}
return StaffPlanPO.builder()
.id(param.getId())
.planNo(param.getPlanNo())
.planName(param.getPlanName())
.planYear(param.getPlanYear())
.timeStart(param.getTimeStart())
.timeEnd(param.getTimeEnd())
.companyId(param.getCompanyId())
.description(param.getDescription())
.forbiddenTag(param.getForbiddenTag() == null ? 0 : param.getForbiddenTag() ? 0 : 1)
.deleteType(0)
.createTime(new Date())
.updateTime(new Date())
.creator(employeeId)
.build();
}
}

@ -0,0 +1,57 @@
package com.engine.organization.entity.staff.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/25
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class StaffPlanSearchParam {
/**
*
*/
private Long id;
/**
*
*/
private String planNo;
/**
*
*/
private String planName;
/**
*
*/
private Integer planYear;
/**
*
*/
private Date timeStart;
/**
*
*/
private Date timeEnd;
/**
*
*/
private String companyId;
/**
*
*/
private String description;
/**
*
*/
private Boolean forbiddenTag;
}

@ -37,11 +37,11 @@ public class StaffPlanPO {
/**
*
*/
private Date time_start;
private Date timeStart;
/**
*
*/
private Date time_end;
private Date timeEnd;
/**
*
*/

@ -0,0 +1,70 @@
package com.engine.organization.entity.staff.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;
import java.util.Date;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/25
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@OrganizationTable(pageId = "e04abd72-dbd6-11ec-b69e-00ffcbed7508",
fields = "t.id, t.plan_no, t.plan_name, t.plan_year, t.time_start, t.time_end, t.forbidden_tag",
fromSql = "FROM jcl_org_staffplan t ",
orderby = "id desc",
primarykey = "id",
operates = {
@OrganizationTableOperate(index = "0", text = "编辑"),
@OrganizationTableOperate(index = "1", text = "删除")
}
)
public class StaffPlanTableVO {
/**
*
*/
private Long id;
/**
*
*/
@OrganizationTableColumn(text = "编号", width = "16%", column = "planNo")
private String planNo;
/**
*
*/
@OrganizationTableColumn(text = "名称", width = "16%", column = "planName")
private String planName;
/**
*
*/
@OrganizationTableColumn(text = "年度", width = "16%", column = "planYear")
private Integer planYear;
/**
*
*/
@OrganizationTableColumn(text = "时间开始", width = "16%", column = "timeStart")
private Date timeStart;
/**
*
*/
@OrganizationTableColumn(text = "时间结束", width = "16%", column = "timeEnd")
private Date timeEnd;
/**
*
*/
@OrganizationTableColumn(text = "状态", width = "16%", column = "forbiddenTag")
private Integer forbiddenTag;
}

@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* @description: TODO
@ -60,6 +61,15 @@ public interface CompMapper {
List<CompPO> listByNo(@Param("compNo") String compNo);
/**
*
*
* @param ids
* @return
*/
List<Map<String, Object>> listCompsByIds(@Param("ids") Collection<Long> ids);
/**
* /
*

@ -197,6 +197,18 @@
</if>
</select>
<select id="listCompsByIds" resultType="java.util.Map">
select
id,
comp_name as name
from jcl_org_comp t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.sequence.po.SequencePO">
update jcl_org_comp
<set>

@ -0,0 +1,63 @@
package com.engine.organization.mapper.staff;
import com.engine.organization.entity.staff.po.StaffPlanPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
* @Author dxfeng
* @Description: TODO
* @Date 2022/5/25
* @Version V1.0
**/
public interface StaffPlanMapper {
/**
* No
*
* @param planNo
* @return
*/
List<StaffPlanPO> listByNo(@Param("planNo") String planNo);
/**
* ID
* @param id
* @return
*/
StaffPlanPO getStaffPlanByID(@Param("id") long id);
/**
*
* @param staffPlanPO
* @return
*/
int insertIgnoreNull(StaffPlanPO staffPlanPO);
/**
*
*
* @param staffPlanPO
* @return
*/
int updateStaffPlan(StaffPlanPO staffPlanPO);
/**
*
*
* @param staffPlanPO
* @return
*/
int updateForbiddenTagById(StaffPlanPO staffPlanPO);
/**
*
*
* @param ids
*/
int deleteByIds(@Param("ids") Collection<Long> ids);
}

@ -0,0 +1,163 @@
<?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.staff.StaffPlanMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.staff.po.StaffPlanPO">
<result column="id" property="id"/>
<result column="plan_no" property="planNo"/>
<result column="plan_name" property="planName"/>
<result column="plan_year" property="planYear"/>
<result column="time_start" property="timeStart"/>
<result column="time_end" property="timeEnd"/>
<result column="company_id" property="companyId"/>
<result column="description" property="description"/>
<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.plan_no
, t.plan_name
, t.plan_year
, t.time_start
, t.time_end
, t.company_id
, t.description
, t.forbidden_tag
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<select id="getStaffPlanByID" parameterType="com.engine.organization.entity.staff.po.StaffPlanPO"
resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_staffplan t where id = #{id} AND delete_type = 0
</select>
<select id="listByNo" parameterType="com.engine.organization.entity.staff.po.StaffPlanPO"
resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_staffplan t where plan_no = #{planNo} AND delete_type = 0
</select>
<update id="updateStaffPlan" parameterType="com.engine.organization.entity.staff.po.StaffPlanPO">
update jcl_org_staffplan
<set>
creator=#{creator},
update_time=#{updateTime},
plan_no=#{planNo},
plan_name=#{planName},
plan_year=#{planYear},
time_start=#{timeStart},
time_end=#{timeEnd},
company_id=#{companyId},
description=#{description},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.staff.po.StaffPlanPO" keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
INSERT INTO jcl_org_staffplan
<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="planNo != null ">
plan_no,
</if>
<if test="planName != null ">
plan_name,
</if>
<if test="planYear != null ">
plan_year,
</if>
<if test="timeStart != null ">
time_start,
</if>
<if test="timeEnd != null ">
time_end,
</if>
<if test="companyId != null ">
company_id,
</if>
<if test="description != null ">
description,
</if>
forbidden_tag,
</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="updateTime != null">
#{updateTime},
</if>
<if test="planNo != null ">
#{planNo},
</if>
<if test="planName != null ">
#{planName},
</if>
<if test="planYear != null ">
#{planYear},
</if>
<if test="timeStart != null ">
#{timeStart},
</if>
<if test="timeEnd != null ">
#{timeEnd},
</if>
<if test="companyId != null ">
#{companyId},
</if>
<if test="description != null ">
#{description},
</if>
0,
</trim>
</insert>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.staff.po.StaffPlanPO">
update jcl_org_staffplan
<set>
forbidden_tag=#{forbiddenTag},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="deleteByIds">
UPDATE jcl_org_staffplan
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

@ -0,0 +1,74 @@
package com.engine.organization.service;
import com.engine.organization.entity.staff.param.StaffPlanSearchParam;
import java.util.Collection;
import java.util.Map;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/25
* @version: 1.0
*/
public interface StaffPlanService {
/**
*
*
* @param params
* @return
*/
Map<String, Object> listPage(StaffPlanSearchParam params);
/**
*
* @param param
* @return
*/
int saveStaffPlan(StaffPlanSearchParam param);
/**
*
*
* @param param
* @return
*/
int updateStaffPlan(StaffPlanSearchParam param);
/**
*
*
* @param params
*/
int updateForbiddenTagById(StaffPlanSearchParam params);
/**
* ID
*
* @param ids
*/
int deleteByIds(Collection<Long> ids);
/**
*
*
* @param params
* @return
*/
Map<String, Object> getSearchCondition(Map<String, Object> params);
/**
*
*
* @param params
* @return
*/
Map<String, Object> getForm(Map<String, Object> params);
/**
*
* @return
*/
Map<String, Object> getHasRight();
}

@ -131,20 +131,16 @@ public class CompServiceImpl extends Service implements CompService {
public int updateComp(Map<String, Object> params) {
CompSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), CompSearchParam.class);
String groupId = (String) params.get("viewCondition");
int updateBaseComp = 0;
CompPO compPO = CompBO.convertParamToPO(searchParam, (long) user.getUID());
if (StringUtil.isEmpty(groupId) || "0".equals(groupId)) {
// 更新主表数据
updateBaseComp = getCompMapper().updateBaseComp(compPO);
} else {
// 更新主表拓展表
updateBaseComp = getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMPEXT, params, groupId, compPO.getId());
}
int updateCount = 0;
// 更新主表数据
updateCount += getCompMapper().updateBaseComp(compPO);
// 更新主表拓展表
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMPEXT, params, groupId, compPO.getId());
//更新明细表
getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_COMPEXT_DT1, params, compPO.getId());
return updateBaseComp;
return updateCount;
}
@Override

@ -58,9 +58,9 @@ public class ExtServiceImpl extends Service implements ExtService {
Map<String, Object> compExtMap = getExtMapper().listCompExt(tableName, fields, id);
// 组装拓展页内容
for (ExtendInfoPO extendInfoPO : infoPOList) {
SearchConditionItem item = ExtendInfoBO.getSearchConditionItem(user, viewAttr, extendInfoPO, compExtMap.get(extendInfoPO.getFieldName()));
SearchConditionItem item = ExtendInfoBO.getSearchConditionItem(user, viewAttr, extendInfoPO, null == compExtMap ? null : compExtMap.get(extendInfoPO.getFieldName()));
item.setFieldcol(16);
if (null != item && 2 == viewAttr && 1 == extendInfoPO.getIsrequired()) {
if ( 2 == viewAttr && 1 == extendInfoPO.getIsrequired()) {
item.setViewAttr(3);
item.setRules("required|string");
}
@ -150,19 +150,17 @@ public class ExtServiceImpl extends Service implements ExtService {
@Override
public void updateExtDT(User user, String extendType, String tableName, Map<String, Object> params, Long id) {
List<ExtendInfoPO> dtInfoPOList = getExtendInfoMapper().listFields(extendType, "", "");
Map<Long, String> groups = dtInfoPOList.stream().collect(Collectors.toMap(ExtendInfoPO::getExtendGroupId, ExtendInfoPO::getTableName, (k1, k2) -> k1));
List<ExtendInfoPO> dtInfoPOList = getExtendInfoMapper().listFields(extendType, "", tableName);
List<Long> groupIds = dtInfoPOList.stream().map(ExtendInfoPO::getExtendGroupId).distinct().collect(Collectors.toList());
Map<Long, List<ExtendInfoPO>> poMaps = dtInfoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId));
// 删除原有明细表数据
groups.forEach((k, v) -> {
if (v.toLowerCase().contains("_dt")) getExtDTMapper().deleteByMainID(v, id);
});
getExtDTMapper().deleteByMainID(tableName, id);
for (Map.Entry<Long, String> entry : groups.entrySet()) {
int rowNum = Util.getIntValue((String) params.get("rownum" + entry.getKey()));
List<ExtendInfoPO> filterS = dtInfoPOList.stream().filter(item -> entry.getKey().equals(item.getExtendGroupId())).collect(Collectors.toList());
for (Long groupId : groupIds) {
int rowNum = Util.getIntValue((String) params.get("rownum" + groupId));
List<ExtendInfoPO> filterS = poMaps.get(groupId);
for (int i = 0; i < rowNum; i++) {
Map<String, Object> map = new HashMap<>();
for (ExtendInfoPO extendInfoPO : filterS) {
if (BROWSER_TYPE == extendInfoPO.getControlType()) {
map.put(extendInfoPO.getFieldName() + "span", params.get(extendInfoPO.getFieldName() + "span_" + i));
@ -174,7 +172,7 @@ public class ExtServiceImpl extends Service implements ExtService {
map.put("delete_type", 0);
map.put("create_time", new Date());
map.put("update_time", new Date());
getExtDTMapper().insertCompExtDT(entry.getValue(), map);
getExtDTMapper().insertCompExtDT(tableName, map);
}
}
}

@ -0,0 +1,235 @@
package com.engine.organization.service.impl;
import com.api.browser.bean.BrowserBean;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.QueryParam;
import com.engine.organization.entity.staff.bo.StaffPlanBO;
import com.engine.organization.entity.staff.param.StaffPlanSearchParam;
import com.engine.organization.entity.staff.po.StaffPlanPO;
import com.engine.organization.entity.staff.vo.StaffPlanTableVO;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.staff.StaffPlanMapper;
import com.engine.organization.service.StaffPlanService;
import com.engine.organization.util.MenuBtn;
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 org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.general.Util;
import java.util.*;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/25
* @version: 1.0
*/
public class StaffPlanServiceImpl extends Service implements StaffPlanService {
private StaffPlanMapper getStaffPlanMapper() {
return MapperProxyFactory.getProxy(StaffPlanMapper.class);
}
private CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class);
}
@Override
public Map<String, Object> listPage(StaffPlanSearchParam params) {
OrganizationWeaTable<StaffPlanTableVO> table = new OrganizationWeaTable<>(user, StaffPlanTableVO.class);
StaffPlanPO staffPlanPO = StaffPlanBO.convertParamToPO(params, (long) user.getUID());
String sqlWhere = buildSqlWhere(staffPlanPO);
table.setSqlwhere(sqlWhere);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
return result.getResultMap();
}
@Override
public int saveStaffPlan(StaffPlanSearchParam param) {
List<StaffPlanPO> list = getStaffPlanMapper().listByNo(Util.null2String(param.getPlanNo()));
OrganizationAssert.isEmpty(list, "编号不允许重复");
StaffPlanPO staffPlanPO = StaffPlanBO.convertParamToPO(param, (long) user.getUID());
return getStaffPlanMapper().insertIgnoreNull(staffPlanPO);
}
@Override
public int updateStaffPlan(StaffPlanSearchParam param) {
StaffPlanPO staffPlanPO = StaffPlanBO.convertParamToPO(param, (long) user.getUID());
return getStaffPlanMapper().updateStaffPlan(staffPlanPO);
}
@Override
public int updateForbiddenTagById(StaffPlanSearchParam params) {
StaffPlanPO staffPlanPO = StaffPlanPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build();
return getStaffPlanMapper().updateForbiddenTagById(staffPlanPO);
}
@Override
public int deleteByIds(Collection<Long> ids) {
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
return getStaffPlanMapper().deleteByIds(ids);
}
@Override
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 planNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "编号", "planNo");
// 名称
SearchConditionItem planNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "planName");
// 年度
SearchConditionItem planYearItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "年度", "179", "planYear", "");
// 时间开始
SearchConditionItem timeStartItem = OrganizationFormItemUtil.datePickerItem(user, 2, 16, false, 2, "时间开始", "timeStart");
// 时间结束
SearchConditionItem timeEndItem = OrganizationFormItemUtil.datePickerItem(user, 2, 16, false, 2, "时间结束", "timeEnd");
// 适用公司
SearchConditionItem companyIdtItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "companyId", "162", "planYear", "compBrowser");
// 说明
SearchConditionItem descriptionItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "说明", "description");
// 状态
List<SearchConditionOption> selectOptions = new ArrayList<>();
SearchConditionOption enableOption = new SearchConditionOption("true", "启用");
SearchConditionOption disableOption = new SearchConditionOption("false", "禁用");
selectOptions.add(enableOption);
selectOptions.add(disableOption);
SearchConditionItem forbiddenTagItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "禁用标记", "forbiddenTag");
conditionItems.add(planNoItem);
conditionItems.add(planNameItem);
conditionItems.add(planYearItem);
conditionItems.add(timeStartItem);
conditionItems.add(timeEndItem);
conditionItems.add(companyIdtItem);
conditionItems.add(descriptionItem);
conditionItems.add(forbiddenTagItem);
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
apiDatas.put("conditions", addGroups);
return apiDatas;
}
@Override
public Map<String, Object> getForm(Map<String, Object> params) {
Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionItem> selectItems = new ArrayList<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
// 编号
SearchConditionItem planNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "编号", "planNo");
planNoItem.setRules("required|string");
// 名称
SearchConditionItem planNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "名称", "planName");
planNameItem.setRules("required|string");
// 年度
SearchConditionItem planYearItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "年度", "178", "planYear", "");
planYearItem.setRules("required|string");
// 时间开始
SearchConditionItem timeStartItem = OrganizationFormItemUtil.datePickerItem(user, 2, 16, false, 3, "时间开始", "timeStart");
timeStartItem.setRules("required|string");
// 时间结束
SearchConditionItem timeEndItem = OrganizationFormItemUtil.datePickerItem(user, 2, 16, false, 3, "时间结束", "timeEnd");
timeEndItem.setRules("required|string");
// 适用公司
SearchConditionItem companyIdtItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "companyId", "162", "planYear", "compBrowser");
companyIdtItem.setRules("required|string");
// 说明
SearchConditionItem descriptionItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "说明", "description");
// 编辑状态下赋值操作
String id = Util.null2String(params.get("id"));
if (!StringUtil.isEmpty(id)) {
StaffPlanPO staffPlanPO = getStaffPlanMapper().getStaffPlanByID(Integer.parseInt(id));
OrganizationAssert.notNull(staffPlanPO, "选择的数据不存在,或数据已删除");
planNoItem.setValue(staffPlanPO.getPlanNo());
planNameItem.setValue(staffPlanPO.getPlanName());
planYearItem.setValue(staffPlanPO.getPlanYear());
timeStartItem.setValue(staffPlanPO.getTimeStart());
timeEndItem.setValue(staffPlanPO.getTimeEnd());
BrowserBean browserBean = companyIdtItem.getBrowserConditionParam();
List<Map<String, Object>> maps = getCompMapper().listCompsByIds(QueryParam.builder().ids(staffPlanPO.getCompanyId().toString()).build().getIds());
browserBean.setReplaceDatas(maps);
companyIdtItem.setBrowserConditionParam(browserBean);
descriptionItem.setValue(staffPlanPO.getDescription());
// 编辑状态下,编号只读
planNoItem.setViewAttr(1);
}
selectItems.add(planNoItem);
selectItems.add(planNameItem);
selectItems.add(planYearItem);
selectItems.add(timeStartItem);
selectItems.add(timeEndItem);
selectItems.add(companyIdtItem);
selectItems.add(descriptionItem);
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
apiDatas.put("condition", addGroups);
return apiDatas;
}
@Override
public Map<String, Object> getHasRight() {
return MenuBtn.getCommonBtnDatas();
}
/**
*
*
* @param staffPlanPO
* @return
*/
private String buildSqlWhere(StaffPlanPO staffPlanPO) {
DBType dbType = DBType.get(new RecordSet().getDBType());
String sqlWhere = " where t.delete_type ='0' ";
String planNo = staffPlanPO.getPlanNo();
if (StringUtils.isNotBlank(planNo)) {
sqlWhere += " AND t.plan_no " + dbType.like(planNo);
}
String planName = staffPlanPO.getPlanName();
if (StringUtils.isNotBlank(planName)) {
sqlWhere += " AND t.plan_name " + dbType.like(planName);
}
Integer planYear = staffPlanPO.getPlanYear();
if (null != planYear) {
sqlWhere += " AND t.plan_year = '" + planYear + "'";
}
Date timeStart = staffPlanPO.getTimeStart();
if (null != timeStart) {
sqlWhere += " AND t.time_start = '" + timeStart + "'";
}
Date timeEnd = staffPlanPO.getTimeEnd();
if (null != timeEnd) {
sqlWhere += " AND t.time_end = '" + timeEnd + "'";
}
String companyId = staffPlanPO.getDescription();
if (StringUtils.isNotBlank(companyId)) {
sqlWhere += " AND t.companyId = '" + companyId + "'";
}
String description = staffPlanPO.getDescription();
if (StringUtils.isNotBlank(description)) {
sqlWhere += " AND t.description " + dbType.like(description);
}
Integer forbiddenTag = staffPlanPO.getForbiddenTag();
if (null != forbiddenTag) {
sqlWhere += " AND t.forbidden_tag = '" + forbiddenTag + "'";
}
return sqlWhere;
}
}

@ -0,0 +1,196 @@
package com.engine.organization.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.entity.QueryParam;
import com.engine.organization.entity.staff.param.StaffPlanSearchParam;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.StaffPlanWrapper;
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.GET;
import javax.ws.rs.POST;
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.Map;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/25
* @version: 1.0
*/
public class StaffPlanController {
public StaffPlanWrapper getStaffPlanWrapper(User user) {
return ServiceUtil.getService(StaffPlanWrapper.class, user);
}
/**
* list
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getTable")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult listStaffPlan(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
StaffPlanSearchParam param = JSONObject.toJavaObject((JSON) JSON.toJSON(map), StaffPlanSearchParam.class);
return ReturnResult.successed(getStaffPlanWrapper(user).listPage(param));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@POST
@Path("/saveStaffPlan")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult saveStaffPlan(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody StaffPlanSearchParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getStaffPlanWrapper(user).saveStaffPlan(param));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
*
*
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/updateStaffPlan")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult updateStaffPlan(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody StaffPlanSearchParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getStaffPlanWrapper(user).updateStaffPlan(param));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
*
*
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/updateForbiddenTagById")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult updateForbiddenTagById(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody StaffPlanSearchParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getStaffPlanWrapper(user).updateForbiddenTagById(param));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
* ID
*
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/deleteByIds")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult deleteByIds(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody QueryParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getStaffPlanWrapper(user).deleteByIds(param.getIds()));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getSearchCondition")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getStaffPlanWrapper(user).getSearchCondition(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getStaffPlanWrapper(user).getForm(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getHasRight")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getHasRight(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getStaffPlanWrapper(user).getHasRight());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
}

@ -0,0 +1,102 @@
package com.engine.organization.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.entity.staff.param.StaffPlanSearchParam;
import com.engine.organization.service.StaffPlanService;
import com.engine.organization.service.impl.StaffPlanServiceImpl;
import org.apache.ibatis.annotations.Param;
import weaver.hrm.User;
import java.util.Collection;
import java.util.Map;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/25
* @version: 1.0
*/
public class StaffPlanWrapper extends Service {
private StaffPlanService getStaffPlanService(User user) {
return ServiceUtil.getService(StaffPlanServiceImpl.class, user);
}
/**
*
*
* @param params
* @return
*/
public Map<String, Object> listPage(StaffPlanSearchParam params) {
return getStaffPlanService(user).listPage(params);
}
/**
*
*
* @param param
* @return
*/
public int saveStaffPlan(StaffPlanSearchParam param) {
return getStaffPlanService(user).saveStaffPlan(param);
}
/**
*
*
* @param param
* @return
*/
public int updateStaffPlan(StaffPlanSearchParam param) {
return getStaffPlanService(user).updateStaffPlan(param);
}
/**
*
*
* @param params
*/
public int updateForbiddenTagById(StaffPlanSearchParam params) {
return getStaffPlanService(user).updateForbiddenTagById(params);
}
/**
* ID
*
* @param ids
*/
public int deleteByIds(@Param("ids") Collection<Long> ids) {
return getStaffPlanService(user).deleteByIds(ids);
}
/**
*
*
* @param params
* @return
*/
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
return getStaffPlanService(user).getSearchCondition(params);
}
/**
*
*
* @param params
* @return
*/
public Map<String, Object> getForm(Map<String, Object> params) {
return getStaffPlanService(user).getForm(params);
}
/**
*
*
* @return
*/
public Map<String, Object> getHasRight() {
return getStaffPlanService(user).getHasRight();
}
}
Loading…
Cancel
Save