人员信息模块
This commit is contained in:
parent
776d60674b
commit
ca7d34a5bd
|
|
@ -525,6 +525,9 @@ create table JCL_ORG_ITEMCLASS (
|
|||
fno varchar(50) not null,
|
||||
fname varchar (50) not null,
|
||||
fmemo varchar (255) null ,
|
||||
creator int null,
|
||||
create_time date null,
|
||||
update_time date null,
|
||||
constraint JCL_ORG_ITEMCLASS_PK primary key (fid)
|
||||
);
|
||||
|
||||
|
|
@ -536,5 +539,8 @@ create table JCL_ORG_ITEM (
|
|||
fname varchar (255) not null,
|
||||
fmemo varchar (255) null,
|
||||
fdelete int not null,
|
||||
creator int null,
|
||||
create_time date null,
|
||||
update_time date null,
|
||||
constraint JCL_ORG_ITEM_PK primary key (fid)
|
||||
);
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.engine.organization.entity.hrmresource.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/8/24
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ResourceItemClassPO {
|
||||
|
||||
private Integer fid;
|
||||
|
||||
private String fno;
|
||||
|
||||
private String fname;
|
||||
|
||||
private String fmemo;
|
||||
|
||||
private Long creator;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.engine.organization.entity.hrmresource.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/8/24
|
||||
* @Version V1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ResourceItemPO {
|
||||
|
||||
private Integer fid;
|
||||
|
||||
private Integer fclassid;
|
||||
|
||||
private String fno;
|
||||
|
||||
private String fname;
|
||||
|
||||
private String fmemo;
|
||||
|
||||
private Integer fdelete;
|
||||
|
||||
private Long creator;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
@ -24,7 +24,8 @@ import lombok.NoArgsConstructor;
|
|||
fields = "t.fid," +
|
||||
"t.fno," +
|
||||
"t.fname," +
|
||||
"t.fmemo",
|
||||
"t.fmemo,"+
|
||||
"t.fdelete",
|
||||
fromSql = "FROM jcl_org_item t ",
|
||||
orderby = "fno",
|
||||
sortway = "asc",
|
||||
|
|
@ -48,18 +49,24 @@ public class ResourceBasicInfoVO {
|
|||
/**
|
||||
* 编号
|
||||
*/
|
||||
@OrganizationTableColumn(text = "编号", width = "25%", column = "fno", orderkey = "fno")
|
||||
@OrganizationTableColumn(text = "编号", width = "20%", column = "fno", orderkey = "fno")
|
||||
private String fNo;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@OrganizationTableColumn(text = "名称", width = "25%", column = "fname")
|
||||
@OrganizationTableColumn(text = "名称", width = "20%", column = "fname")
|
||||
private String fName;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
@OrganizationTableColumn(text = "说明", width = "25%", column = "fmemo")
|
||||
@OrganizationTableColumn(text = "说明", width = "20%", column = "fmemo")
|
||||
private String fMemo;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@OrganizationTableColumn(text = "状态", width = "20%", column = "fdelete")
|
||||
private String fDelete;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ public enum OperateTypeEnum {
|
|||
MOVE("5", "转移"),
|
||||
MERGE("6", "合并"),
|
||||
COPY("7", "复制"),
|
||||
CANCELED("8", "封存");
|
||||
CANCELED("8", "封存"),
|
||||
RECOVER("9","恢复");
|
||||
|
||||
private String value;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package com.engine.organization.mapper.hrmresource;
|
||||
|
||||
|
||||
import com.engine.organization.entity.TreeData;
|
||||
import com.engine.organization.entity.hrmresource.po.ResourceItemPO;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/8/24
|
||||
* @Version V1.0
|
||||
**/
|
||||
public interface ResourceBasicInfoMapper {
|
||||
|
||||
ArrayList<TreeData> getTreeData();
|
||||
|
||||
@MapKey("id")
|
||||
List<Map<String, Object>> browserDatas(@Param("ids") Collection<Long> ids);
|
||||
|
||||
|
||||
ResourceItemPO getResourceItemByFid(@Param("fid")Integer fid);
|
||||
|
||||
List<ResourceItemPO> selectItemByIds(@Param("ids")Collection<Long> ids);
|
||||
|
||||
int deleteByIds(@Param("ids")Collection<Long> ids);
|
||||
|
||||
int recoverByIds(@Param("ids")Collection<Long> ids);
|
||||
|
||||
List<ResourceItemPO> selectItemByFNo(@Param("fno")String fno);
|
||||
|
||||
int insertIgnoreNull(ResourceItemPO resourceItemPO);
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
<?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.hrmresource.ResourceBasicInfoMapper">
|
||||
|
||||
<resultMap id="ItemResultMap" type="com.engine.organization.entity.hrmresource.po.ResourceItemPO">
|
||||
<result column="fid" property="fid"/>
|
||||
<result column="fclassid" property="fclassid"/>
|
||||
<result column="fno" property="fno"/>
|
||||
<result column="fname" property="fname"/>
|
||||
<result column="fmemo" property="fmemo"/>
|
||||
<result column="fdelete" property="fdelete"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="TreeResultMap" type="com.engine.organization.entity.TreeData">
|
||||
<result column="id" property="key"/>
|
||||
<result column="scheme_name" property="title"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getTreeData" resultMap="TreeResultMap">
|
||||
select fid, fname
|
||||
from jcl_org_itemclass
|
||||
</select>
|
||||
|
||||
<select id="browserDatas" resultType="java.util.Map">
|
||||
select
|
||||
fid as `id`,
|
||||
fname as `name`
|
||||
from jcl_org_itemclass
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getResourceItemByFid" resultType="com.engine.organization.entity.hrmresource.po.ResourceItemPO">
|
||||
select fid,fclassid,fno,fname,fmemo,fdelete,creator,create_time,update_time
|
||||
from jcl_org_item
|
||||
where fdelete = 0 and fid = #{fid}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectItemByIds" resultMap="ItemResultMap">
|
||||
select fid,fclassid,fno,fname,fmemo,fdelete,creator,create_time,update_time
|
||||
from jcl_org_item
|
||||
where fdelete = 0
|
||||
AND fid IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectItemByFNo" resultMap="ItemResultMap">
|
||||
select fid,fclassid,fno,fname,fmemo,fdelete,creator,create_time,update_time
|
||||
from jcl_org_item
|
||||
where fdelete = 0
|
||||
AND fno = #{fno}
|
||||
</select>
|
||||
|
||||
<update id="deleteByIds">
|
||||
UPDATE jcl_org_item
|
||||
SET fdelete = 1
|
||||
WHERE fdelete = 0
|
||||
AND fid IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<update id="recoverByIds">
|
||||
UPDATE jcl_org_item
|
||||
SET fdelete = 0
|
||||
WHERE fdelete = 1
|
||||
AND fid IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.hrmresource.po.ResourceItemPO" keyProperty="id"
|
||||
keyColumn="id" useGeneratedKeys="true">
|
||||
INSERT INTO jcl_org_item
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="fclassid != null">
|
||||
fclassid,
|
||||
</if>
|
||||
<if test="fno != null">
|
||||
fno,
|
||||
</if>
|
||||
<if test="fname != null">
|
||||
fname,
|
||||
</if>
|
||||
<if test="fmemo != null">
|
||||
fmemo,
|
||||
</if>
|
||||
<if test="fdelete != null">
|
||||
fdelete,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="fclassid != null">
|
||||
#{fclassid},
|
||||
</if>
|
||||
<if test="fno != null">
|
||||
#{fno},
|
||||
</if>
|
||||
<if test="fname != null">
|
||||
#{fname},
|
||||
</if>
|
||||
<if test="fmemo != null">
|
||||
#{fmemo},
|
||||
</if>
|
||||
<if test="fdelete != null">
|
||||
#{fdelete},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!--oracle未处理-->
|
||||
<!--<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.hrmresource.po.ResourceItemPO"-->
|
||||
<!--databaseId="oracle">-->
|
||||
<!--</insert>-->
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
package com.engine.organization.service;
|
||||
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
||||
import com.engine.organization.entity.hrmresource.po.ResourceItemPO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -25,4 +28,46 @@ public interface ResourceBasicInfoService {
|
|||
* @return
|
||||
*/
|
||||
List<TypeTreeVO> getTreeData();
|
||||
|
||||
/**
|
||||
* 新增编辑表单
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<SearchConditionGroup> getForm(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 删除/批量删除人员信息资料
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int deletByIds(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 恢复人员信息资料
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int recoverByIds(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 保存人员信息资料
|
||||
* @param resourceItemPO
|
||||
* @return
|
||||
*/
|
||||
int save(ResourceItemPO resourceItemPO);
|
||||
|
||||
/**
|
||||
* 根据id获取人员信息资料
|
||||
* @param fid
|
||||
* @return
|
||||
*/
|
||||
ResourceItemPO selectById(Integer fid);
|
||||
|
||||
/**
|
||||
* 更新人员信息资料
|
||||
* @param resourceItemPO
|
||||
* @return
|
||||
*/
|
||||
int update(ResourceItemPO resourceItemPO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,29 @@
|
|||
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.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.TreeData;
|
||||
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
||||
import com.engine.organization.entity.hrmresource.po.ResourceItemPO;
|
||||
import com.engine.organization.entity.hrmresource.vo.ResourceBasicInfoVO;
|
||||
import com.engine.organization.mapper.hrmresource.ResourceBasicInfoMapper;
|
||||
import com.engine.organization.service.ResourceBasicInfoService;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
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.Util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -25,6 +35,10 @@ public class ResourceBasicInfoServiceImpl extends Service implements ResourceBas
|
|||
|
||||
private static final String RIGHT_NAME = "ResourceBasicInfo:All";
|
||||
|
||||
private ResourceBasicInfoMapper getResourceBasicInfoMapper() {
|
||||
return MapperProxyFactory.getProxy(ResourceBasicInfoMapper.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(Map<String, Object> params) {
|
||||
|
|
@ -46,12 +60,99 @@ public class ResourceBasicInfoServiceImpl extends Service implements ResourceBas
|
|||
|
||||
@Override
|
||||
public List<TypeTreeVO> getTreeData() {
|
||||
ArrayList<TreeData> treeDataList = getResourceBasicInfoMapper().getTreeData();
|
||||
TypeTreeVO build = TypeTreeVO.builder()
|
||||
.childs(treeDataList.stream().map(e ->
|
||||
TypeTreeVO.builder()
|
||||
.domid(e.getKey())
|
||||
.key(Long.parseLong(e.getKey()))
|
||||
.name(e.getTitle())
|
||||
.build()).collect(Collectors.toList()))
|
||||
.haschild(true)
|
||||
.domid("-1")
|
||||
.key(-1L)
|
||||
.name("全部类型").build();
|
||||
List<TypeTreeVO> typeTreeVOS = new ArrayList<>();
|
||||
typeTreeVOS.add(build);
|
||||
return typeTreeVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SearchConditionGroup> getForm(Map<String, Object> params) {
|
||||
|
||||
String id = Util.null2String(params.get("id"));
|
||||
String fClassId = Util.null2String(params.get("fclassid"));
|
||||
List<SearchConditionItem> selectItems = new ArrayList<>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
SearchConditionItem resourceTypeItem = OrganizationFormItemUtil.browserItem(user, 2, 17, 3, false, "类型", "161", "fclassid", "resourceTypeBrowser");
|
||||
resourceTypeItem.setRules("required|string");
|
||||
if (StringUtils.isNotBlank(fClassId)) {
|
||||
BrowserBean browserBean = resourceTypeItem.getBrowserConditionParam();
|
||||
List<Map<String, Object>> maps = getResourceBasicInfoMapper().browserDatas(DeleteParam.builder().ids(fClassId).build().getIds());
|
||||
browserBean.setReplaceDatas(maps);
|
||||
resourceTypeItem.setBrowserConditionParam(browserBean);
|
||||
}
|
||||
|
||||
SearchConditionItem fNo = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "编号", "fno");
|
||||
fNo.setRules("required|string");
|
||||
SearchConditionItem fName = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "名称", "fname");
|
||||
fName.setRules("required|string");
|
||||
SearchConditionItem fMemo = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 60, "说明", "fmemo");
|
||||
|
||||
if(StringUtils.isNotBlank(id)) {
|
||||
ResourceItemPO resourceItemPO = getResourceBasicInfoMapper().getResourceItemByFid(Integer.parseInt(id));
|
||||
OrganizationAssert.notNull(resourceItemPO,"选择的数据不存在");
|
||||
BrowserBean browserBean = resourceTypeItem.getBrowserConditionParam();
|
||||
List<Map<String, Object>> maps = getResourceBasicInfoMapper().browserDatas(DeleteParam.builder().ids(resourceItemPO.getFid().toString()).build().getIds());
|
||||
browserBean.setReplaceDatas(maps);
|
||||
resourceTypeItem.setBrowserConditionParam(browserBean);
|
||||
|
||||
fNo.setValue(resourceItemPO.getFno());
|
||||
fNo.setViewAttr(1);
|
||||
fName.setValue(resourceItemPO.getFname());
|
||||
fMemo.setValue(resourceItemPO.getFmemo());
|
||||
}
|
||||
|
||||
selectItems.add(resourceTypeItem);
|
||||
selectItems.add(fNo);
|
||||
selectItems.add(fName);
|
||||
selectItems.add(fMemo);
|
||||
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
|
||||
return addGroups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deletByIds(Collection<Long> ids) {
|
||||
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
|
||||
return getResourceBasicInfoMapper().deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recoverByIds(Collection<Long> ids) {
|
||||
OrganizationAssert.notEmpty(ids, "请选择要恢复的数据");
|
||||
return getResourceBasicInfoMapper().recoverByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(ResourceItemPO resourceItemPO) {
|
||||
List<ResourceItemPO> list = getResourceBasicInfoMapper().selectItemByFNo(resourceItemPO.getFno());
|
||||
OrganizationAssert.isEmpty(list,"编号不允许重复");
|
||||
return getResourceBasicInfoMapper().insertIgnoreNull(resourceItemPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceItemPO selectById(Integer fid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(ResourceItemPO resourceItemPO) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private String buildSqlWhere(Map<String, Object> params) {
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
String sqlWhere = " where t.fdelete = 0 ";
|
||||
String sqlWhere = " where 1 = 1 ";
|
||||
String fclassid = (String) params.get("fclassid");
|
||||
if (StringUtils.isNotBlank(fclassid) && !"-1".equals(fclassid)) {
|
||||
sqlWhere += " AND t.fclassid = '" + fclassid + "'";
|
||||
|
|
|
|||
|
|
@ -178,7 +178,8 @@ public class SchemeServiceImpl extends Service implements SchemeService {
|
|||
*/
|
||||
private String buildSqlWhere(Map<String, Object> params) {
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
String sqlWhere = " where delete_type ='0' ";
|
||||
//String sqlWhere = " where delete_type ='0' ";
|
||||
String sqlWhere = " where 1 = 1 ";
|
||||
String name = (String) params.get("schemeName");
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
sqlWhere += " AND scheme_name " + dbType.like(name);
|
||||
|
|
|
|||
|
|
@ -2,14 +2,18 @@ package com.engine.organization.web;
|
|||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.hrmresource.po.ResourceItemPO;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.ResourceBasicInfoWrapper;
|
||||
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;
|
||||
|
|
@ -28,6 +32,18 @@ public class ResourceBasicInfoController {
|
|||
return ServiceUtil.getService(ResourceBasicInfoWrapper.class,user);
|
||||
}
|
||||
|
||||
@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(getResourceBasicInfoWrapper(user).getHasRight());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/getTable")
|
||||
|
|
@ -55,4 +71,68 @@ public class ResourceBasicInfoController {
|
|||
}
|
||||
}
|
||||
|
||||
@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(getResourceBasicInfoWrapper(user).getForm(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/delete")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult delete(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeleteParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getResourceBasicInfoWrapper(user).deleteByIds(param.getIds()));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/recover")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult recover(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeleteParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getResourceBasicInfoWrapper(user).recoverByIds(param.getIds()));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult save(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ResourceItemPO resourceItemPO) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getResourceBasicInfoWrapper(user).save(resourceItemPO));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/update")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult update(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ResourceItemPO resourceItemPO) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getResourceBasicInfoWrapper(user).update(resourceItemPO));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,23 @@
|
|||
package com.engine.organization.wrapper;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.annotation.Log;
|
||||
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
||||
import com.engine.organization.entity.hrmresource.po.ResourceItemPO;
|
||||
import com.engine.organization.enums.DeleteTypeEnum;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.hrmresource.ResourceBasicInfoMapper;
|
||||
import com.engine.organization.service.ResourceBasicInfoService;
|
||||
import com.engine.organization.service.impl.ResourceBasicInfoServiceImpl;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -22,6 +31,10 @@ public class ResourceBasicInfoWrapper extends OrganizationWrapper {
|
|||
return ServiceUtil.getService(ResourceBasicInfoServiceImpl.class,user);
|
||||
}
|
||||
|
||||
private ResourceBasicInfoMapper getResourceBasicInfoMapper() {
|
||||
return MapperProxyFactory.getProxy(ResourceBasicInfoMapper.class);
|
||||
}
|
||||
|
||||
public Map<String, Object> getResourceBasicInfo(Map<String, Object> params) {
|
||||
return getResourceBasicInfoService(user).listPage(params);
|
||||
}
|
||||
|
|
@ -29,4 +42,72 @@ public class ResourceBasicInfoWrapper extends OrganizationWrapper {
|
|||
public List<TypeTreeVO> getTreeData() {
|
||||
return getResourceBasicInfoService(user).getTreeData();
|
||||
}
|
||||
|
||||
|
||||
public List<SearchConditionGroup> getForm(Map<String, Object> params) {
|
||||
return getResourceBasicInfoService(user).getForm(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getHasRight() {
|
||||
Map<String, Object> btnDatas = new HashMap<>();
|
||||
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
|
||||
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
|
||||
// 新增
|
||||
topMenuList.add(MenuBtn.builder().isBatch("0").isTop("1").menuFun("addItemClass").menuIcon("icon-coms-New-Flow").menuName("新增类型").type("BTN_AddItemClass").build());
|
||||
topMenuList.add(MenuBtn.builder().isBatch("0").isTop("1").menuFun("editItemClass").menuIcon("icon-coms-edit").menuName("修改类型").type("BTN_EditItemClass").build());
|
||||
topMenuList.add(MenuBtn.builder().isBatch("0").isTop("1").menuFun("delItemClass").menuIcon("icon-coms-Delete").menuName("删除类型").type("BTN_DelItemClass").build());
|
||||
topMenuList.add(MenuBtn.topMenu_addNew());
|
||||
// 批量删除
|
||||
topMenuList.add(MenuBtn.topMenu_batchDelete());
|
||||
btnDatas.put("topMenu", topMenuList);
|
||||
// 新增
|
||||
rightMenuList.add(MenuBtn.rightMenu_addNew());
|
||||
// 日志
|
||||
rightMenuList.add(MenuBtn.rightMenu_btnLog());
|
||||
// 显示列定制
|
||||
rightMenuList.add(MenuBtn.rightMenu_btnColumn());
|
||||
btnDatas.put("rightMenu", rightMenuList);
|
||||
return btnDatas;
|
||||
}
|
||||
|
||||
@Log(operateType = OperateTypeEnum.DELETE, operateModule = LogModuleNameEnum.RESOURCE, operateDesc = "删除人员信息资料")
|
||||
public int deleteByIds(Collection<Long> ids) {
|
||||
List<ResourceItemPO> resourceItemPOS = getResourceBasicInfoMapper().selectItemByIds(ids);
|
||||
int result = getResourceBasicInfoService(user).deletByIds(ids);
|
||||
for (ResourceItemPO resourceItemPO : resourceItemPOS) {
|
||||
writeOperateLog(new Object() {}.getClass(),resourceItemPO.getFname(), JSON.toJSONString(ids),"删除人员信息资料");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Log(operateType = OperateTypeEnum.RECOVER, operateModule = LogModuleNameEnum.RESOURCE, operateDesc = "恢复人员信息资料")
|
||||
public int recoverByIds(Collection<Long> ids) {
|
||||
List<ResourceItemPO> resourceItemPOS = getResourceBasicInfoMapper().selectItemByIds(ids);
|
||||
int result = getResourceBasicInfoService(user).recoverByIds(ids);
|
||||
for (ResourceItemPO resourceItemPO : resourceItemPOS) {
|
||||
writeOperateLog(new Object() {}.getClass(),resourceItemPO.getFname(), JSON.toJSONString(ids),"恢复人员信息资料");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.RESOURCE, operateDesc = "新增人员信息资料")
|
||||
public int save(ResourceItemPO resourceItemPO) {
|
||||
resourceItemPO.setCreateTime(new Date());
|
||||
resourceItemPO.setCreator((long)user.getUID());
|
||||
resourceItemPO.setFdelete(DeleteTypeEnum.NOT_DELETED.getValue());
|
||||
int result = getResourceBasicInfoService(user).save(resourceItemPO);
|
||||
writeOperateLog(new Object() {}.getClass(),resourceItemPO.getFname(),JSON.toJSONString(resourceItemPO),"新增人员信息资料");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.RESOURCE, operateDesc = "更新人员信息资料")
|
||||
public int update(ResourceItemPO resourceItemPO) {
|
||||
resourceItemPO.setUpdateTime(new Date());
|
||||
ResourceItemPO resourceItem = getResourceBasicInfoService(user).selectById(resourceItemPO.getFid());
|
||||
int result = getResourceBasicInfoService(user).update(resourceItemPO);
|
||||
writeOperateLog(new Object() {}.getClass(),resourceItem.getFname(),JSON.toJSONString(resourceItemPO),resourceItem,
|
||||
getResourceBasicInfoService(user).selectById(resourceItemPO.getFid()));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue