diff --git a/src/com/api/organization/web/PostInfoController.java b/src/com/api/organization/web/PostInfoController.java new file mode 100644 index 00000000..701e6646 --- /dev/null +++ b/src/com/api/organization/web/PostInfoController.java @@ -0,0 +1,15 @@ +package com.api.organization.web; + +import javax.ws.rs.Path; + +/** + * + * @description: TODO + * @author:dxfeng + * @createTime: 2022/05/13 + * @version: 1.0 + */ +@Path("/bs/hrmorganization/postinfo") +public class PostInfoController extends com.engine.organization.web.PostInfoController { + +} diff --git a/src/com/engine/organization/entity/post/dto/PostInfoDTO.java b/src/com/engine/organization/entity/post/dto/PostInfoDTO.java new file mode 100644 index 00000000..1c04fbe7 --- /dev/null +++ b/src/com/engine/organization/entity/post/dto/PostInfoDTO.java @@ -0,0 +1,34 @@ +package com.engine.organization.entity.post.dto; + +import com.engine.organization.entity.post.param.PostInfoSearchParam; +import com.engine.organization.entity.post.po.PostInfoPO; + +import java.util.Date; + +/** + * @description: TODO + * @author:dxfeng + * @createTime: 2022/05/13 + * @version: 1.0 + */ +public class PostInfoDTO { + public static PostInfoPO convertParamToPO(PostInfoSearchParam param, Long employeeId) { + if (param == null) { + return null; + } + return PostInfoPO.builder() + .id(param.getId() == null ? 0 : param.getId()) + .postInfoNo(param.getPostInfoNo() == null ? null : param.getPostInfoNo()) + .postInfoName(param.getPostInfoName() == null ? null : param.getPostInfoName()) + .postInfoAuthority(param.getPostInfoAuthority() == null ? null : param.getPostInfoAuthority()) + .postInfoDuty(param.getPostInfoDuty() == null ? null : param.getPostInfoDuty()) + .postInfoQualification(param.getPostInfoQualification() == null ? null : param.getPostInfoQualification()) + .postId(param.getPostId() == null ? null : param.getPostId()) + .description(param.getDescription() == null ? null : param.getDescription()) + .deleteType(0) + .createTime(new Date()) + .updateTime(new Date()) + .creator(employeeId) + .build(); + } +} diff --git a/src/com/engine/organization/entity/post/param/PostInfoSearchParam.java b/src/com/engine/organization/entity/post/param/PostInfoSearchParam.java new file mode 100644 index 00000000..a0f6eac2 --- /dev/null +++ b/src/com/engine/organization/entity/post/param/PostInfoSearchParam.java @@ -0,0 +1,51 @@ +package com.engine.organization.entity.post.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @description: TODO + * @author:dxfeng + * @createTime: 2022/05/13 + * @version: 1.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PostInfoSearchParam { + /** + * 主键 + */ + private Long id; + /** + * 编号 + */ + private String postInfoNo; + /** + * 名称 + */ + private String postInfoName; + /** + * 权限 + */ + private String postInfoAuthority; + /** + * 责任 + */ + private String postInfoDuty; + /** + * 资格 + */ + private String postInfoQualification; + /** + * 职务分类 + */ + private Integer postId; + /** + * 说明 + */ + private String description; +} diff --git a/src/com/engine/organization/entity/post/po/PostInfoPO.java b/src/com/engine/organization/entity/post/po/PostInfoPO.java new file mode 100644 index 00000000..84f5425f --- /dev/null +++ b/src/com/engine/organization/entity/post/po/PostInfoPO.java @@ -0,0 +1,59 @@ +package com.engine.organization.entity.post.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @description: TODO + * @author:dxfeng + * @createTime: 2022/05/13 + * @version: 1.0 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class PostInfoPO { + /** + * 主键 + */ + private Long id; + /** + * 编号 + */ + private String postInfoNo; + /** + * 名称 + */ + private String postInfoName; + /** + * 权限 + */ + private String postInfoAuthority; + /** + * 责任 + */ + private String postInfoDuty; + /** + * 资格 + */ + private String postInfoQualification; + /** + * 职务分类 + */ + private Integer postId; + /** + * 说明 + */ + private String description; + + private Long creator; + private int deleteType; + private Date createTime; + private Date updateTime; + +} diff --git a/src/com/engine/organization/entity/post/vo/PostInfoTableVO.java b/src/com/engine/organization/entity/post/vo/PostInfoTableVO.java new file mode 100644 index 00000000..3014f36f --- /dev/null +++ b/src/com/engine/organization/entity/post/vo/PostInfoTableVO.java @@ -0,0 +1,79 @@ +package com.engine.organization.entity.post.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; + +/** + * @description: TODO + * @author:dxfeng + * @createTime: 2022/05/13 + * @version: 1.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@OrganizationTable(pageId = "fa30e916-d285-11ec-bc87-00ffcbed7508", + fields = " t.id," + + " t.post_info_no," + + " t.post_info_name," + + " t.post_info_authority," + + " t.post_info_duty," + + " t.post_info_qualification," + + " a.post_name," + + " t.description", + fromSql = " from jcl_org_post_info t inner join jcl_org_post a on t.post_id = a.id ", + orderby = "id desc", + primarykey = "id", + operates = { + @OrganizationTableOperate(index = "0", text = "编辑"), + @OrganizationTableOperate(index = "1", text = "删除") + } +) +public class PostInfoTableVO { + /** + * 主键 + */ + @OrganizationTableColumn(column = "id", display = false) + private Long id; + /** + * 编号 + */ + @OrganizationTableColumn(text = "编号", width = "20%", column = "post_info_no") + private String postInfoNo; + /** + * 名称 + */ + @OrganizationTableColumn(text = "名称", width = "20%", column = "post_info_name") + private String postInfoName; + /** + * 权限 + */ + @OrganizationTableColumn(text = "权限", width = "20%", column = "post_info_authority") + private String postInfoAuthority; + /** + * 责任 + */ + @OrganizationTableColumn(text = "责任", width = "20%", column = "post_info_duty") + private String postInfoDuty; + /** + * 资格 + */ + @OrganizationTableColumn(text = "资格", width = "20%", column = "post_info_qualification") + private String postInfoQualification; + /** + * 职务分类 + */ + @OrganizationTableColumn(text = "职务分类", width = "20%", column = "post_name") + private Integer postName; + /** + * 说明 + */ + @OrganizationTableColumn(text = "说明", width = "20%", column = "description") + private String description; +} diff --git a/src/com/engine/organization/mapper/post/PostInfoMapper.java b/src/com/engine/organization/mapper/post/PostInfoMapper.java new file mode 100644 index 00000000..10815a74 --- /dev/null +++ b/src/com/engine/organization/mapper/post/PostInfoMapper.java @@ -0,0 +1,67 @@ +package com.engine.organization.mapper.post; + + +import com.engine.organization.entity.post.po.PostInfoPO; +import org.apache.ibatis.annotations.MapKey; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * @Author dxfeng + * @Description: TODO + * @Date 2022/5/13 + * @Version V1.0 + **/ +public interface PostInfoMapper { + + /** + * 根据No查询职务信息 + * + * @param postInfoNo + * @return + */ + List listByNo(@Param("postInfoNo") String postInfoNo); + + /** + * 获取职务信息根据ID + * @param id + * @return + */ + PostInfoPO getPostInfoByID(@Param("id") long id); + + /** + * 根据ID查询职务信息列表 + * + * @param ids + * @return + */ + @MapKey("id") + List> listPostInfosByIds(@Param("ids") Collection ids); + + /** + * 插入职务信息 + * @param postInfoPO + * @return + */ + int insertIgnoreNull(PostInfoPO postInfoPO); + + /** + * 修改,修改所有字段 + * + * @param postInfoPO + * @return + */ + int updatePostInfo(PostInfoPO postInfoPO); + + /** + * 批量删除职务信息方案 + * + * @param ids + */ + int deleteByIds(@Param("ids") Collection ids); + + +} diff --git a/src/com/engine/organization/mapper/post/PostInfoMapper.xml b/src/com/engine/organization/mapper/post/PostInfoMapper.xml new file mode 100644 index 00000000..1d919c2e --- /dev/null +++ b/src/com/engine/organization/mapper/post/PostInfoMapper.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + t + . + id + , t.post_info_no + , t.post_info_name + , t.post_info_authority + , t.post_info_duty + , t.post_info_qualification + , t.post_id + , t.description + , t.creator + , t.delete_type + , t.create_time + , t.update_time + + + + + + + + + update jcl_org_post_info + + creator=#{creator}, + update_time=#{updateTime}, + post_info_no=#{postInfoNo}, + post_info_name=#{postInfoName}, + post_info_authority=#{postInfoAuthority}, + post_info_duty=#{postInfoDuty}, + post_info_qualification=#{postInfoQualification}, + post_id=#{postId}, + description=#{description}, + + WHERE id = #{id} AND delete_type = 0 + + + + INSERT INTO jcl_org_post_info + + + creator, + + + delete_type, + + + create_time, + + + update_time, + + + post_info_no, + + + post_info_name, + + + post_info_authority, + + + post_info_duty, + + + post_info_qualification, + + + post_id, + + + description, + + + + + + #{creator}, + + + #{deleteType}, + + + #{createTime}, + + + #{updateTime}, + + + #{postInfoNo}, + + + #{postInfoName}, + + + #{postInfoAuthority}, + + + #{postInfoDuty}, + + + #{postInfoQualification}, + + + #{postId}, + + + #{description}, + + + + + + + UPDATE jcl_org_post_info + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + \ No newline at end of file diff --git a/src/com/engine/organization/mapper/post/PostMapper.xml b/src/com/engine/organization/mapper/post/PostMapper.xml index 0a0e4e18..0bb49259 100644 --- a/src/com/engine/organization/mapper/post/PostMapper.xml +++ b/src/com/engine/organization/mapper/post/PostMapper.xml @@ -7,7 +7,7 @@ - + diff --git a/src/com/engine/organization/mapper/scheme/GradeMapper.xml b/src/com/engine/organization/mapper/scheme/GradeMapper.xml index 1e9d4122..ccc1b0c6 100644 --- a/src/com/engine/organization/mapper/scheme/GradeMapper.xml +++ b/src/com/engine/organization/mapper/scheme/GradeMapper.xml @@ -10,7 +10,7 @@ - + diff --git a/src/com/engine/organization/mapper/scheme/LevelMapper.xml b/src/com/engine/organization/mapper/scheme/LevelMapper.xml index f8c65a5a..c34dfe85 100644 --- a/src/com/engine/organization/mapper/scheme/LevelMapper.xml +++ b/src/com/engine/organization/mapper/scheme/LevelMapper.xml @@ -9,7 +9,7 @@ - + diff --git a/src/com/engine/organization/mapper/sequence/SequenceMapper.xml b/src/com/engine/organization/mapper/sequence/SequenceMapper.xml index 1b000446..ca6a0d38 100644 --- a/src/com/engine/organization/mapper/sequence/SequenceMapper.xml +++ b/src/com/engine/organization/mapper/sequence/SequenceMapper.xml @@ -9,7 +9,7 @@ - + diff --git a/src/com/engine/organization/service/PostInfoService.java b/src/com/engine/organization/service/PostInfoService.java new file mode 100644 index 00000000..7211fbcb --- /dev/null +++ b/src/com/engine/organization/service/PostInfoService.java @@ -0,0 +1,70 @@ +package com.engine.organization.service; + +import com.engine.organization.entity.post.param.PostInfoSearchParam; + +import java.util.Collection; +import java.util.Map; + +/** + * @description: TODO + * @author:dxfeng + * @createTime: 2022/05/13 + * @version: 1.0 + */ +public interface PostInfoService { + /** + * 职务信息列表 + * + * @param params + * @return + */ + Map listPage(Map params); + + /** + * 新增职务信息 + * @param param + * @return + */ + int savePostInfo(PostInfoSearchParam param); + + /** + * 更新职务信息信息 + * + * @param param + * @return + */ + int updatePostInfo(PostInfoSearchParam param); + + + /** + * 根据ID批量删除 + * + * @param ids + */ + int deleteByIds(Collection ids); + + /** + * 获取搜索条件 + * + * @param params + * @return + */ + Map getSearchCondition(Map params); + + + /** + * 获取新增表单 + * + * @param params + * @return + */ + Map getPostInfoForm(Map params); + + /** + * 获取列表页面按钮信息 + * @return + */ + Map getHasRight(); + + +} diff --git a/src/com/engine/organization/service/impl/GradeServiceImpl.java b/src/com/engine/organization/service/impl/GradeServiceImpl.java index 592e21fd..d3ee4021 100644 --- a/src/com/engine/organization/service/impl/GradeServiceImpl.java +++ b/src/com/engine/organization/service/impl/GradeServiceImpl.java @@ -190,7 +190,7 @@ public class GradeServiceImpl extends Service implements GradeService { } String schemeId = (String) params.get("schemeId"); if (StringUtils.isNotBlank(schemeId)) { - sqlWhere += " AND t.scheme_id " + dbType.like(schemeId); + sqlWhere += " AND t.scheme_id = '" + schemeId + "'"; } String viewCondition = (String) params.get("viewCondition"); // -1:全部、0:启用、1:禁用 diff --git a/src/com/engine/organization/service/impl/LevelServiceImpl.java b/src/com/engine/organization/service/impl/LevelServiceImpl.java index 31350daa..837b84d6 100644 --- a/src/com/engine/organization/service/impl/LevelServiceImpl.java +++ b/src/com/engine/organization/service/impl/LevelServiceImpl.java @@ -177,7 +177,7 @@ public class LevelServiceImpl extends Service implements LevelService { } String schemeId = (String) params.get("schemeId"); if (StringUtils.isNotBlank(schemeId)) { - sqlWhere += " AND t.scheme_id " + dbType.like(schemeId); + sqlWhere += " AND t.scheme_id = '" + schemeId + "'"; } String viewCondition = (String) params.get("viewCondition"); // -1:全部、0:启用、1:禁用 diff --git a/src/com/engine/organization/service/impl/PostInfoServiceImpl.java b/src/com/engine/organization/service/impl/PostInfoServiceImpl.java new file mode 100644 index 00000000..3b33daa2 --- /dev/null +++ b/src/com/engine/organization/service/impl/PostInfoServiceImpl.java @@ -0,0 +1,176 @@ +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.QueryParam; +import com.engine.organization.entity.post.dto.PostInfoDTO; +import com.engine.organization.entity.post.param.PostInfoSearchParam; +import com.engine.organization.entity.post.po.PostInfoPO; +import com.engine.organization.entity.post.vo.PostInfoTableVO; +import com.engine.organization.mapper.post.PostInfoMapper; +import com.engine.organization.mapper.post.PostMapper; +import com.engine.organization.service.PostInfoService; +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/13 + * @version: 1.0 + */ +public class PostInfoServiceImpl extends Service implements PostInfoService { + + private PostInfoMapper getPostInfoMapper() { + return MapperProxyFactory.getProxy(PostInfoMapper.class); + } + + private PostMapper getPostMapper() { + return MapperProxyFactory.getProxy(PostMapper.class); + } + + @Override + public Map listPage(Map params) { + OrganizationWeaTable table = new OrganizationWeaTable<>(user, PostInfoTableVO.class); + String sqlWhere = buildSqlWhere(params); + table.setSqlwhere(sqlWhere); + WeaResultMsg result = new WeaResultMsg(false); + result.putAll(table.makeDataResult()); + result.success(); + return result.getResultMap(); + } + + + @Override + public int savePostInfo(PostInfoSearchParam param) { + List list = getPostInfoMapper().listByNo(Util.null2String(param.getPostInfoNo())); + OrganizationAssert.isEmpty(list, "编号不允许重复"); + PostInfoPO postInfoPO = PostInfoDTO.convertParamToPO(param, (long) user.getUID()); + return getPostInfoMapper().insertIgnoreNull(postInfoPO); + } + + @Override + public int updatePostInfo(PostInfoSearchParam param) { + PostInfoPO postInfoPO = PostInfoDTO.convertParamToPO(param, (long) user.getUID()); + return getPostInfoMapper().updatePostInfo(postInfoPO); + } + + + @Override + public int deleteByIds(Collection ids) { + OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); + return getPostInfoMapper().deleteByIds(ids); + } + + + @Override + public Map getSearchCondition(Map params) { + Map apiDatas = new HashMap<>(); + List addGroups = new ArrayList<>(); + List conditionItems = new ArrayList<>(); + SearchConditionItem browserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "职务分类", "161", "postId", "postBrowser"); + SearchConditionItem nameCondition = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "postInfoName"); + conditionItems.add(browserItem); + conditionItems.add(nameCondition); + addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems)); + apiDatas.put("conditions", addGroups); + return apiDatas; + } + + + @Override + public Map getPostInfoForm(Map params) { + Map apiDatas = new HashMap<>(); + List selectItems = new ArrayList<>(); + List addGroups = new ArrayList<>(); + // 编号 + SearchConditionItem noItem = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "编号", "postInfoNo"); + noItem.setRules("required|string"); + // 名称 + SearchConditionItem nameItem = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "名称", "postInfoName"); + nameItem.setRules("required|string"); + // 权限 + SearchConditionItem authorityItem = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "权限", "postInfoAuthority"); + // 责任 + SearchConditionItem dutyItem = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "责任", "postInfoDuty"); + // 资格 + SearchConditionItem qualificationItem = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "资格", "postInfoQualification"); + // 职务分类 + SearchConditionItem postIdBrowser = OrganizationFormItemUtil.browserItem(user, 2, 17, 3, false, "职务分类", "161", "postId", "postBrowser"); + // 说明 + SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 60, "描述说明", "description"); + + // 编辑状态下赋值操作 + String id = Util.null2String(params.get("id")); + if (!StringUtil.isEmpty(id)) { + PostInfoPO postInfoPO = getPostInfoMapper().getPostInfoByID(Integer.parseInt(id)); + OrganizationAssert.notNull(postInfoPO, "选择的数据不存在,或数据已删除"); + + noItem.setValue(postInfoPO.getPostInfoNo()); + nameItem.setValue(postInfoPO.getPostInfoName()); + authorityItem.setValue(postInfoPO.getPostInfoAuthority()); + dutyItem.setValue(postInfoPO.getPostInfoDuty()); + qualificationItem.setValue(postInfoPO.getPostInfoQualification()); + descriptionItem.setValue(postInfoPO.getDescription()); + + BrowserBean browserBean = postIdBrowser.getBrowserConditionParam(); + List> maps = getPostMapper().listPostsByIds(QueryParam.builder().ids(postInfoPO.getPostId().toString()).build().getIds()); + + browserBean.setReplaceDatas(maps); + postIdBrowser.setBrowserConditionParam(browserBean); + // 编辑状态下,编号只读 + noItem.setViewAttr(1); + } + + selectItems.add(noItem); + selectItems.add(nameItem); + selectItems.add(authorityItem); + selectItems.add(dutyItem); + selectItems.add(qualificationItem); + selectItems.add(postIdBrowser); + selectItems.add(descriptionItem); + addGroups.add(new SearchConditionGroup("基本信息", true, selectItems)); + apiDatas.put("condition", addGroups); + return apiDatas; + } + + @Override + public Map getHasRight() { + return MenuBtn.getCommonBtnDatas(); + } + + + /** + * 查询条件 + * + * @param params + * @return + */ + private String buildSqlWhere(Map params) { + DBType dbType = DBType.get(new RecordSet().getDBType()); + String sqlWhere = " where t.delete_type ='0' "; + String sequenceName = (String) params.get("postInfoName"); + if (StringUtils.isNotBlank(sequenceName)) { + sqlWhere += " AND t.post_info_name " + dbType.like(sequenceName); + } + String postId = (String) params.get("postId"); + if (StringUtils.isNotBlank(postId)) { + sqlWhere += " AND t.post_id ='" + postId + "'"; + } + return sqlWhere; + } +} diff --git a/src/com/engine/organization/service/impl/SequenceServiceImpl.java b/src/com/engine/organization/service/impl/SequenceServiceImpl.java index c370239a..d33aafaa 100644 --- a/src/com/engine/organization/service/impl/SequenceServiceImpl.java +++ b/src/com/engine/organization/service/impl/SequenceServiceImpl.java @@ -177,7 +177,7 @@ public class SequenceServiceImpl extends Service implements SequenceService { } String schemeId = (String) params.get("schemeId"); if (StringUtils.isNotBlank(schemeId)) { - sqlWhere += " AND t.scheme_id " + dbType.like(schemeId); + sqlWhere += " AND t.scheme_id = '" + schemeId + "'"; } String viewCondition = (String) params.get("viewCondition"); // -1:全部、0:启用、1:禁用 diff --git a/src/com/engine/organization/web/PostInfoController.java b/src/com/engine/organization/web/PostInfoController.java new file mode 100644 index 00000000..c5650e98 --- /dev/null +++ b/src/com/engine/organization/web/PostInfoController.java @@ -0,0 +1,174 @@ +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.post.param.PostInfoSearchParam; +import com.engine.organization.util.response.ReturnResult; +import com.engine.organization.wrapper.PostInfoWrapper; +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/13 + * @version: 1.0 + */ +public class PostInfoController { + public PostInfoWrapper getPostInfoWrapper(User user) { + return ServiceUtil.getService(PostInfoWrapper.class, user); + } + + /** + * 获取list列表 + * + * @param request + * @param response + * @return + */ + @GET + @Path("/getPostInfoTable") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult listPostInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + User user = HrmUserVarify.getUser(request, response); + Map map = ParamUtil.request2Map(request); + return ReturnResult.successed(getPostInfoWrapper(user).listPage(map)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e.getMessage()); + } + } + + /** + * 添加职务信息 + * + * @param request + * @param response + * @return + */ + @POST + @Path("/savePostInfo") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult savePostInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody PostInfoSearchParam param) { + try { + User user = HrmUserVarify.getUser(request, response); + return ReturnResult.successed(getPostInfoWrapper(user).savePostInfo(param)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e.getMessage()); + } + } + + /** + * 更新职务信息,修改所有字段 + * + * @param request + * @param response + * @param param + * @return + */ + @POST + @Path("/updatePostInfo") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult updatePostInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody PostInfoSearchParam param) { + try { + User user = HrmUserVarify.getUser(request, response); + return ReturnResult.successed(getPostInfoWrapper(user).updatePostInfo(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(getPostInfoWrapper(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 map = ParamUtil.request2Map(request); + return ReturnResult.successed(getPostInfoWrapper(user).getSearchCondition(map)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e.getMessage()); + } + } + + + /** + * 新增、编辑表单 + * + * @param request + * @param response + * @return + */ + @GET + @Path("/getPostInfoForm") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult getPostInfoForm(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + User user = HrmUserVarify.getUser(request, response); + Map map = ParamUtil.request2Map(request); + return ReturnResult.successed(getPostInfoWrapper(user).getPostInfoForm(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(getPostInfoWrapper(user).getHasRight()); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e.getMessage()); + } + } + +} diff --git a/src/com/engine/organization/wrapper/PostInfoWrapper.java b/src/com/engine/organization/wrapper/PostInfoWrapper.java new file mode 100644 index 00000000..8b6288cc --- /dev/null +++ b/src/com/engine/organization/wrapper/PostInfoWrapper.java @@ -0,0 +1,94 @@ +package com.engine.organization.wrapper; + +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.organization.entity.post.param.PostInfoSearchParam; +import com.engine.organization.service.PostInfoService; +import com.engine.organization.service.impl.PostInfoServiceImpl; +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/13 + * @version: 1.0 + */ +public class PostInfoWrapper extends Service { + private PostInfoService getPostInfoService(User user) { + return ServiceUtil.getService(PostInfoServiceImpl.class, user); + } + + /** + * 职务信息列表 + * + * @param params + * @return + */ + public Map listPage(Map params) { + return getPostInfoService(user).listPage(params); + } + + /** + * 新增职务信息 + * + * @param param + * @return + */ + public int savePostInfo(PostInfoSearchParam param) { + return getPostInfoService(user).savePostInfo(param); + } + + /** + * 更新职务信息 + * + * @param param + * @return + */ + public int updatePostInfo(PostInfoSearchParam param) { + return getPostInfoService(user).updatePostInfo(param); + } + + /** + * 根据ID批量删除 + * + * @param ids + */ + public int deleteByIds(@Param("ids") Collection ids) { + return getPostInfoService(user).deleteByIds(ids); + } + + /** + * 获取搜索条件 + * + * @param params + * @return + */ + public Map getSearchCondition(Map params) { + return getPostInfoService(user).getSearchCondition(params); + } + + + /** + * 获取新增表单 + * + * @param params + * @return + */ + public Map getPostInfoForm(Map params) { + return getPostInfoService(user).getPostInfoForm(params); + } + + /** + * 获取列表页面按钮信息 + * + * @return + */ + public Map getHasRight() { + return getPostInfoService(user).getHasRight(); + } + +}