职务分类接口 表结构更新

pull/7/MERGE
dxfeng 3 years ago
parent 902f845543
commit 8e4d698217

@ -59,7 +59,7 @@ CREATE TABLE JCL_ORG_SEQUENCE (
-- JCL_ORG_POST
CREATE TABLE JCL_ORG_POST (
id int auto_increment NOT NULL,
post_no int null,
post_no varchar(100) null,
post_name varchar(100) NULL,
description text NULL,
creator int null,
@ -72,12 +72,12 @@ CREATE TABLE JCL_ORG_POST (
-- JCL_ORG_POST_INFO
CREATE TABLE JCL_ORG_POST_INFO (
id int auto_increment NOT NULL,
post_info_no int null,
post_info_no varchar(100) null,
post_info_name varchar(100) NULL,
post_info_authority text null,
post_info_duty text null,
post_info_qualification text null,
post_type int null,
post_id int null,
description text NULL,
creator int null,
delete_type int null,

@ -61,7 +61,7 @@ CREATE TABLE JCL_ORG_SEQUENCE (
-- JCL_ORG_POST
CREATE TABLE JCL_ORG_POST (
ID NUMBER NOT NULL,
POST_NO NUMBER NULL,
POST_NO NVARCHAR2(100) NULL,
POST_NAME NVARCHAR2(100) NULL,
DESCRIPTION NVARCHAR2(1000) NULL,
CREATOR NUMBER NULL,
@ -74,12 +74,12 @@ CREATE TABLE JCL_ORG_POST (
-- JCL_ORG_POST_INFO
CREATE TABLE JCL_ORG_POST_INFO (
ID NUMBER NOT NULL,
POST_INFO_NO NUMBER NULL,
POST_INFO_NO NVARCHAR2(100) NULL,
POST_INFO_NAME NVARCHAR2(100) NULL,
POST_INFO_AUTHORITY NVARCHAR2(1000) NULL,
POST_INFO_DUTY NVARCHAR2(1000) NULL,
POST_INFO_QUALIFICATION NVARCHAR2(1000) NULL,
POST_TYPE NUMBER NULL,
POST_ID NUMBER NULL,
DESCRIPTION NVARCHAR2(1000) NULL,
CREATOR NUMBER NULL,
DELETE_TYPE NUMBER NULL,

@ -59,7 +59,7 @@ CREATE TABLE JCL_ORG_SEQUENCE (
-- JCL_ORG_POST
CREATE TABLE JCL_ORG_POST (
id int IDENTITY(1,1) NOT NULL,
post_no int null,
post_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
post_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
description text COLLATE Chinese_PRC_CI_AS NULL,
creator int null,
@ -72,12 +72,12 @@ CREATE TABLE JCL_ORG_POST (
-- JCL_ORG_POST_INFO
CREATE TABLE JCL_ORG_POST_INFO (
id int IDENTITY(1,1) NOT NULL,
post_info_no int null,
post_info_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
post_info_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
post_info_authority text null,
post_info_duty text null,
post_info_qualification text null,
post_type int null,
post_id int null,
description text COLLATE Chinese_PRC_CI_AS NULL,
creator int null,
delete_type int null,

@ -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/post")
public class PostController extends com.engine.organization.web.PostController {
}

@ -0,0 +1,30 @@
package com.engine.organization.entity.post.dto;
import com.engine.organization.entity.post.po.PostPO;
import java.util.Date;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/13
* @version: 1.0
*/
public class PostDTO {
public static PostPO convertPO(PostPO postPO, long employeeId) {
if (postPO == null) {
return null;
}
return PostPO.builder()
.id(postPO.getId() == null ? 0 : postPO.getId())
.postNo(postPO.getPostNo() == null ? null : postPO.getPostNo())
.postName(postPO.getPostName() == null ? null : postPO.getPostName())
.description(postPO.getDescription() == null ? null : postPO.getDescription())
.deleteType(0)
.createTime(new Date())
.updateTime(new Date())
.creator(employeeId)
.build();
}
}

@ -0,0 +1,42 @@
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 PostPO {
/**
*
*/
private Long id;
/**
*
*/
private String postNo;
/**
*
*/
private String postName;
/**
*
*/
private String description;
private Long creator;
private int deleteType;
private Date createTime;
private Date updateTime;
}

@ -0,0 +1,69 @@
package com.engine.organization.mapper.post;
import com.engine.organization.entity.post.po.PostPO;
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 PostMapper {
/**
* No
*
* @param postNo
* @return
*/
List<PostPO> listByNo(@Param("postNo") String postNo);
/**
* ID
*
* @param id
* @return
*/
PostPO getPostByID(@Param("id") long id);
/**
* ID
*
*
* @param ids
* @return
*/
@MapKey("id")
List<Map<String, Object>> listPostsByIds(@Param("ids") Collection<Long> ids);
/**
*
*
* @param postPO
* @return
*/
int insertIgnoreNull(PostPO postPO);
/**
*
*
* @param postPO
* @return
*/
int updatePost(PostPO postPO);
/**
*
*
* @param ids
*/
int deleteByIds(@Param("ids") Collection<Long> ids);
}

@ -0,0 +1,130 @@
<?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.post.PostMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.post.po.PostPO">
<result column="id" property="id"/>
<result column="post_no" property="postNo"/>
<result column="post_name" property="postName"/>
<result column="description" property="description"/>
<result column="creator" property="creator"/>
<result column="creator" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.post_no
, t.post_name
, t.description
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<select id="getPostByID" parameterType="com.engine.organization.entity.post.po.PostPO"
resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_post t where id = #{id} AND delete_type = 0
</select>
<select id="listByNo" parameterType="com.engine.organization.entity.post.po.PostPO" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_post t where post_no = #{postNo} AND delete_type = 0
</select>
<!-- 浏览按钮赋值、展示用 -->
<select id="listPostsByIds" resultType="java.util.Map">
select
id,
post_name as name
from jcl_org_post t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<update id="updatePost" parameterType="com.engine.organization.entity.post.po.PostPO">
update jcl_org_post
<set>
creator=#{creator},
update_time=#{updateTime},
post_no=#{postNo},
post_name=#{postName},
description=#{description},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.post.po.PostPO" keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
INSERT INTO jcl_org_post
<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="postNo != null ">
post_no,
</if>
<if test="postName != null ">
post_name,
</if>
<if test="description != null ">
description,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="postNo != null ">
#{postNo},
</if>
<if test="postName != null ">
#{postName},
</if>
<if test="description != null ">
#{description},
</if>
</trim>
</insert>
<update id="deleteByIds">
UPDATE jcl_org_post
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,47 @@
package com.engine.organization.service;
import com.engine.organization.entity.post.po.PostPO;
import java.util.Collection;
import java.util.Map;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/13
* @version: 1.0
*/
public interface PostService {
/**
*
* @param postPO
* @return
*/
int savePost(PostPO postPO);
/**
*
*
* @param postPO
* @return
*/
int updatePost(PostPO postPO);
/**
* ID
*
* @param ids
*/
int deleteByIds(Collection<Long> ids);
/**
*
*
* @param params
* @return
*/
Map<String, Object> getPostForm(Map<String, Object> params);
}

@ -0,0 +1,78 @@
package com.engine.organization.service.impl;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.engine.core.impl.Service;
import com.engine.organization.entity.post.dto.PostDTO;
import com.engine.organization.entity.post.po.PostPO;
import com.engine.organization.mapper.post.PostMapper;
import com.engine.organization.service.PostService;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import weaver.general.StringUtil;
import weaver.general.Util;
import java.util.*;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/13
* @version: 1.0
*/
public class PostServiceImpl extends Service implements PostService {
private PostMapper getPostMapper() {
return MapperProxyFactory.getProxy(PostMapper.class);
}
@Override
public int savePost(PostPO postPO) {
List<PostPO> list = getPostMapper().listByNo(Util.null2String(postPO.getPostNo()));
OrganizationAssert.isEmpty(list, "编号不允许重复");
return getPostMapper().insertIgnoreNull(PostDTO.convertPO(postPO,user.getUID()));
}
@Override
public int updatePost(PostPO postPO) {
return getPostMapper().updatePost(PostDTO.convertPO(postPO,user.getUID()));
}
@Override
public int deleteByIds(Collection<Long> ids) {
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
return getPostMapper().deleteByIds(ids);
}
@Override
public Map<String, Object> getPostForm(Map<String, Object> params) {
Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionItem> selectItems = new ArrayList<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
SearchConditionItem postNameItem = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "名称", "postName");
postNameItem.setRules("required|string");
SearchConditionItem postNoItem = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "编号", "postNo");
postNoItem.setRules("required|string");
SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 60, "描述说明", "description");
// 编辑状态下赋值操作
String id = Util.null2String(params.get("id"));
if (!StringUtil.isEmpty(id)) {
PostPO postPO = getPostMapper().getPostByID(Integer.parseInt(id));
OrganizationAssert.notNull(postPO, "选择的数据不存在,或数据已删除");
postNameItem.setValue(postPO.getPostName());
postNoItem.setValue(postPO.getPostNo());
descriptionItem.setValue(postPO.getDescription());
}
selectItems.add(postNoItem);
selectItems.add(postNameItem);
selectItems.add(descriptionItem);
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
apiDatas.put("condition", addGroups);
return apiDatas;
}
}

@ -0,0 +1,117 @@
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.po.PostPO;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.PostWrapper;
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 PostController {
public PostWrapper getPostWrapper(User user) {
return ServiceUtil.getService(PostWrapper.class, user);
}
/**
*
*
* @param request
* @param response
* @param postPO
* @return
*/
@POST
@Path("/savePost")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult savePost(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody PostPO postPO) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getPostWrapper(user).savePost(postPO));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
*
*
* @param request
* @param response
* @param postPO
* @return
*/
@POST
@Path("/updatePost")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult updatePost(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody PostPO postPO) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getPostWrapper(user).updatePost(postPO));
} 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(getPostWrapper(user).deleteByIds(param.getIds()));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
*
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getPostForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getPostForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getPostWrapper(user).getPostForm(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
}

@ -62,12 +62,12 @@ public class SequenceController {
@Path("/saveSequence")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult saveSequence(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SequenceSearchParam param) {
//try {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getSequenceWrapper(user).saveSequence(param));
//} catch (Exception e) {
// return ReturnResult.exceptionHandle(e.getMessage());
//}
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**

@ -0,0 +1,64 @@
package com.engine.organization.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.entity.post.po.PostPO;
import com.engine.organization.service.PostService;
import com.engine.organization.service.impl.PostServiceImpl;
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 PostWrapper extends Service {
private PostService getPostService(User user) {
return ServiceUtil.getService(PostServiceImpl.class, user);
}
/**
*
*
* @param postPO
* @return
*/
public int savePost(PostPO postPO) {
return getPostService(user).savePost(postPO);
}
/**
*
*
* @param postPO
* @return
*/
public int updatePost(PostPO postPO) {
return getPostService(user).updatePost(postPO);
}
/**
* ID
*
* @param ids
*/
public int deleteByIds(@Param("ids") Collection<Long> ids) {
return getPostService(user).deleteByIds(ids);
}
/**
*
*
* @param params
* @return
*/
public Map<String, Object> getPostForm(Map<String, Object> params) {
return getPostService(user).getPostForm(params);
}
}
Loading…
Cancel
Save