diff --git a/docs/表结构SQL/MySQL.sql b/docs/表结构SQL/MySQL.sql index 64ee5105..0c925db3 100644 --- a/docs/表结构SQL/MySQL.sql +++ b/docs/表结构SQL/MySQL.sql @@ -17,7 +17,7 @@ CREATE TABLE JCL_ORG_LEVEL ( level_no varchar(100) NULL, level_name varchar(100) NULL, description text NULL, - level_scheme int null, + scheme_id int null, forbidden_tag int NULL, creator int null, delete_type int null, @@ -31,7 +31,7 @@ CREATE TABLE JCL_ORG_GRADE ( grade_no varchar(100) NULL, grade_name varchar(100) NULL, description text NULL, - level_scheme int null, + scheme_id int null, level_id int null, forbidden_tag int NULL, creator int null, @@ -47,7 +47,7 @@ CREATE TABLE JCL_ORG_SEQUENCE ( sequence_no varchar(100) NULL, sequence_name varchar(100) NULL, description text NULL, - level_scheme int null, + scheme_id int null, forbidden_tag int NULL, creator int null, delete_type int null, @@ -248,7 +248,7 @@ CREATE TABLE JCL_ORG_JOB ( parent_comp int null, parent_dept int null, job_sequence int null, - level_scheme int null, + scheme_id int null, parent_job int null, is_key_job int null, workplace varchar(100) NULL, diff --git a/docs/表结构SQL/Oracle.sql b/docs/表结构SQL/Oracle.sql index e5cb8b4e..d4e9c140 100644 --- a/docs/表结构SQL/Oracle.sql +++ b/docs/表结构SQL/Oracle.sql @@ -17,7 +17,7 @@ CREATE TABLE JCL_ORG_LEVEL ( LEVEL_NO NVARCHAR2(100) NULL, LEVEL_NAME NVARCHAR2(100) NULL, DESCRIPTION NVARCHAR2(1000) NULL, - LEVEL_SCHEME NUMBER NULL, + SCHEME_ID NUMBER NULL, FORBIDDEN_TAG NUMBER NULL, CREATOR NUMBER NULL, DELETE_TYPE NUMBER NULL, @@ -32,7 +32,7 @@ CREATE TABLE JCL_ORG_GRADE ( GRADE_NO NVARCHAR2(100) NULL, GRADE_NAME NVARCHAR2(100) NULL, DESCRIPTION NVARCHAR2(1000) NULL, - LEVEL_SCHEME NUMBER NULL, + SCHEME_ID NUMBER NULL, LEVEL_ID NUMBER NULL, FORBIDDEN_TAG NUMBER NULL, CREATOR NUMBER NULL, @@ -49,7 +49,7 @@ CREATE TABLE JCL_ORG_SEQUENCE ( SEQUENCE_NO NVARCHAR2(100) NULL, SEQUENCE_NAME NVARCHAR2(100) NULL, DESCRIPTION NVARCHAR2(1000) NULL, - LEVEL_SCHEME NUMBER NULL, + SCHEME_ID NUMBER NULL, FORBIDDEN_TAG NUMBER NULL, CREATOR NUMBER NULL, DELETE_TYPE NUMBER NULL, @@ -250,7 +250,7 @@ CREATE TABLE JCL_ORG_JOB ( PARENT_COMP NUMBER NULL, PARENT_DEPT NUMBER NULL, JOB_SEQUENCE NUMBER NULL, - LEVEL_SCHEME NUMBER NULL, + SCHEME_ID NUMBER NULL, PARENT_JOB NUMBER NULL, IS_KEY_JOB NUMBER NULL, WORKPLACE NVARCHAR2(100) NULL, diff --git a/docs/表结构SQL/SqlServer.sql b/docs/表结构SQL/SqlServer.sql index 8f28508d..ec4262a4 100644 --- a/docs/表结构SQL/SqlServer.sql +++ b/docs/表结构SQL/SqlServer.sql @@ -17,7 +17,7 @@ CREATE TABLE JCL_ORG_LEVEL ( level_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, level_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, description text COLLATE Chinese_PRC_CI_AS NULL, - level_scheme int null, + scheme_id int null, forbidden_tag int NULL, creator int null, delete_type int null, @@ -31,7 +31,7 @@ CREATE TABLE JCL_ORG_GRADE ( grade_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, grade_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, description text COLLATE Chinese_PRC_CI_AS NULL, - level_scheme int null, + scheme_id int null, level_id int null, forbidden_tag int NULL, creator int null, @@ -47,7 +47,7 @@ CREATE TABLE JCL_ORG_SEQUENCE ( sequence_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL, sequence_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL, description text COLLATE Chinese_PRC_CI_AS NULL, - level_scheme int null, + scheme_id int null, forbidden_tag int NULL, creator int null, delete_type int null, @@ -248,7 +248,7 @@ CREATE TABLE JCL_ORG_JOB ( parent_comp int null, parent_dept int null, job_sequence int null, - level_scheme int null, + scheme_id int null, parent_job int null, is_key_job int null, workplace varchar(100) COLLATE Chinese_PRC_CI_AS NULL, diff --git a/src/com/api/organization/web/LevelController.java b/src/com/api/organization/web/LevelController.java new file mode 100644 index 00000000..019b2529 --- /dev/null +++ b/src/com/api/organization/web/LevelController.java @@ -0,0 +1,15 @@ +package com.api.organization.web; + +import javax.ws.rs.Path; + +/** + * + * @description: TODO + * @author:dxfeng + * @createTime: 2022/05/10 + * @version: 1.0 + */ +@Path("/bs/hrmorganization/level") +public class LevelController extends com.engine.organization.web.LevelController { + +} diff --git a/src/com/engine/organization/entity/scheme/dto/LevelDTO.java b/src/com/engine/organization/entity/scheme/dto/LevelDTO.java new file mode 100644 index 00000000..4bf86d20 --- /dev/null +++ b/src/com/engine/organization/entity/scheme/dto/LevelDTO.java @@ -0,0 +1,82 @@ +package com.engine.organization.entity.scheme.dto; + +import com.engine.organization.entity.scheme.param.LevelSearchParam; +import com.engine.organization.entity.scheme.po.LevelPO; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Author dxfeng + * @Description: TODO + * @Date 2022/5/9 + * @Version V1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class LevelDTO { + /** + * 自增主键 + */ + private long id; + /** + * 编号 + */ + private String levelNo; + /** + * 方案名称 + */ + private String levelName; + /** + * 方案说明 + */ + private String description; + /** + * 等级方案 + */ + private Long schemeId; + /** + * 禁用标记 + */ + private int forbiddenTag; + /** + * + */ + private Long creator; + /** + * + */ + private int deleteType; + /** + * + */ + private Date createTime; + /** + * + */ + private Date updateTime; + + public static LevelPO convertParamToPO(LevelSearchParam param, Long employeeId) { + if (param == null) { + return null; + } + return LevelPO.builder() + .id(param.getId() == null ? 0 : param.getId()) + .levelNo(param.getLevelNo() == null ? null : param.getLevelNo()) + .levelName(param.getLevelName() == null ? null : param.getLevelName()) + .description(param.getDescription() == null ? null : param.getDescription()) + .schemeId(param.getSchemeId() == null ? 0 : param.getSchemeId()) + .forbiddenTag(param.getForbiddenTag() == null ? 0 : param.getForbiddenTag() ? 0 : 1) + .deleteType(0) + .createTime(new Date()) + .updateTime(new Date()) + .creator(employeeId) + .build(); + } + +} diff --git a/src/com/engine/organization/entity/scheme/dto/SchemeDTO.java b/src/com/engine/organization/entity/scheme/dto/SchemeDTO.java index 926df6ce..b442cf71 100644 --- a/src/com/engine/organization/entity/scheme/dto/SchemeDTO.java +++ b/src/com/engine/organization/entity/scheme/dto/SchemeDTO.java @@ -65,7 +65,7 @@ public class SchemeDTO { .id(param.get("id") == null ? 0 : Integer.parseInt((String) param.get("id"))) .schemeNo(param.get("scheme_no") == null ? null : (String) param.get("scheme_no")) .schemeName(param.get("scheme_name") == null ? null : (String) param.get("scheme_name")) - .schemeDescription(param.get("scheme_description") == null ? null : (String) param.get("descrscheme_descriptioniption")) + .schemeDescription(param.get("scheme_description") == null ? null : (String) param.get("scheme_description")) .forbiddenTag(param.get("forbidden_tag") == null ? 0 : Integer.parseInt((String) param.get("forbidden_tag"))) .deleteType(0) .createTime(new Date()) diff --git a/src/com/engine/organization/entity/scheme/param/LevelSearchParam.java b/src/com/engine/organization/entity/scheme/param/LevelSearchParam.java new file mode 100644 index 00000000..b4e5bf13 --- /dev/null +++ b/src/com/engine/organization/entity/scheme/param/LevelSearchParam.java @@ -0,0 +1,46 @@ +package com.engine.organization.entity.scheme.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author dxfeng + * @Description: TODO + * @Date 2022/5/9 + * @Version V1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class LevelSearchParam { + + private Long id; + /** + * 编号 + */ + private String levelNo; + + /** + * 名称 + */ + private String levelName; + + /** + * 方案说明 + */ + private String description; + + /** + * 等级方案 + */ + private Long schemeId; + + /** + * 禁用标记 + */ + private Boolean forbiddenTag; + +} diff --git a/src/com/engine/organization/entity/scheme/po/LevelPO.java b/src/com/engine/organization/entity/scheme/po/LevelPO.java index b9f18b06..b20d3c5d 100644 --- a/src/com/engine/organization/entity/scheme/po/LevelPO.java +++ b/src/com/engine/organization/entity/scheme/po/LevelPO.java @@ -39,7 +39,7 @@ public class LevelPO { /** * 等级方案标识 */ - private Long levelScheme; + private Long schemeId; /** *禁用标记 */ diff --git a/src/com/engine/organization/entity/scheme/vo/LevelTableVO.java b/src/com/engine/organization/entity/scheme/vo/LevelTableVO.java index 32edbac8..8b6a841e 100644 --- a/src/com/engine/organization/entity/scheme/vo/LevelTableVO.java +++ b/src/com/engine/organization/entity/scheme/vo/LevelTableVO.java @@ -19,13 +19,13 @@ import lombok.NoArgsConstructor; "t.level_name," + "t.description," + "s.scheme_name," + - "t.level_scheme," + + "t.scheme_id," + "t.forbidden_tag," + "t.creator," + "t.delete_type," + "t.create_time," + "t.update_time", - fromSql = "FROM jcl_org_level t inner join jcl_org_scheme s on t.level_scheme = s.id ", + fromSql = "FROM jcl_org_level t inner join jcl_org_scheme s on t.scheme_id = s.id ", orderby = "id desc", primarykey = "id", operates = { @@ -60,7 +60,7 @@ public class LevelTableVO { * 等级方案 */ // @OrganizationTableColumn(text = "等级方案", width = "20%", column = "level_scheme") - private String levelScheme; + private String schemeId; /** * 等级方案 diff --git a/src/com/engine/organization/mapper/scheme/LevelMapper.java b/src/com/engine/organization/mapper/scheme/LevelMapper.java new file mode 100644 index 00000000..2768a852 --- /dev/null +++ b/src/com/engine/organization/mapper/scheme/LevelMapper.java @@ -0,0 +1,62 @@ +package com.engine.organization.mapper.scheme; + + +import com.engine.organization.entity.scheme.po.LevelPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +/** + * @Author dxfeng + * @Description: TODO + * @Date 2022/5/9 + * @Version V1.0 + **/ +public interface LevelMapper { + + /** + * 根据No查询登记方案 + * + * @param levelNo + * @return + */ + List listByNo(@Param("levelNo") String levelNo); + + /** + * 获取职等根据ID + * @param id + * @return + */ + LevelPO getLevelByID(@Param("id") long id); + + /** + * 插入职等 + * @param levelPO + * @return + */ + int insertIgnoreNull(LevelPO levelPO); + + /** + * 修改,修改所有字段 + * + * @param levelPO + * @return + */ + int updateLevel(LevelPO levelPO); + + /** + * 更新禁用标记 + * + * @param levelPO + * @return + */ + int updateForbiddenTagById(LevelPO levelPO); + + /** + * 批量删除登记方案 + * + * @param ids + */ + int deleteByIds(@Param("ids") Collection ids); +} diff --git a/src/com/engine/organization/mapper/scheme/LevelMapper.xml b/src/com/engine/organization/mapper/scheme/LevelMapper.xml new file mode 100644 index 00000000..00ce54a7 --- /dev/null +++ b/src/com/engine/organization/mapper/scheme/LevelMapper.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + t + . + id + , t.level_no + , t.level_name + , t.description + , t.scheme_id + , t.forbidden_tag + , t.creator + , t.delete_type + , t.create_time + , t.update_time + + + + + + + update jcl_org_level + + creator=#{creator}, + update_time=#{updateTime}, + level_no=#{levelNo}, + level_name=#{levelName}, + description=#{description}, + scheme_id=#{schemeId}, + + WHERE id = #{id} AND delete_type = 0 + + + + INSERT INTO jcl_org_level + + + creator, + + + delete_type, + + + create_time, + + + update_time, + + + level_no, + + + level_name, + + + description, + + + scheme_id, + + forbidden_tag, + + + + #{creator}, + + + #{deleteType}, + + + #{createTime}, + + + #{updateTime}, + + + #{levelNo}, + + + #{levelName}, + + + #{description}, + + + #{schemeId}, + + 0, + + + + + update jcl_org_level + + forbidden_tag=#{forbiddenTag}, + + WHERE id = #{id} AND delete_type = 0 + + + + UPDATE jcl_org_level + 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/service/LevelService.java b/src/com/engine/organization/service/LevelService.java index 122abac2..1e8373f5 100644 --- a/src/com/engine/organization/service/LevelService.java +++ b/src/com/engine/organization/service/LevelService.java @@ -1,5 +1,8 @@ package com.engine.organization.service; +import com.engine.organization.entity.scheme.param.LevelSearchParam; + +import java.util.Collection; import java.util.Map; /** @@ -10,10 +13,63 @@ import java.util.Map; */ public interface LevelService { /** - * 等级方案列表 + * 职等列表 * * @param params * @return */ Map listPage(Map params); + + /** + * 新增职等 + * @param param + * @return + */ + int saveLevel(LevelSearchParam param); + + /** + * 更新职等信息 + * + * @param param + * @return + */ + int updateLevel(LevelSearchParam param); + + /** + * 更新禁用标记 + * + * @param params + */ + int updateForbiddenTagById(LevelSearchParam params); + + /** + * 根据ID批量删除 + * + * @param ids + */ + int deleteByIds(Collection ids); + + /** + * 获取搜索条件 + * + * @param params + * @return + */ + Map getSearchCondition(Map params); + + + /** + * 获取新增表单 + * + * @param params + * @return + */ + Map getLevelForm(Map params); + + /** + * 获取列表页面按钮信息 + * @return + */ + Map getTableBtn(); + } diff --git a/src/com/engine/organization/service/impl/LevelServiceImpl.java b/src/com/engine/organization/service/impl/LevelServiceImpl.java index fac1fe7e..5a679bfb 100644 --- a/src/com/engine/organization/service/impl/LevelServiceImpl.java +++ b/src/com/engine/organization/service/impl/LevelServiceImpl.java @@ -1,31 +1,46 @@ package com.engine.organization.service.impl; +import com.api.browser.bean.SearchConditionGroup; +import com.api.browser.bean.SearchConditionItem; import com.cloudstore.eccom.result.WeaResultMsg; import com.engine.core.impl.Service; import com.engine.organization.component.OrganizationWeaTable; +import com.engine.organization.entity.scheme.dto.LevelDTO; +import com.engine.organization.entity.scheme.param.LevelSearchParam; +import com.engine.organization.entity.scheme.po.LevelPO; import com.engine.organization.entity.scheme.vo.LevelTableVO; -import com.engine.organization.entity.scheme.vo.SchemeTableVO; +import com.engine.organization.mapper.scheme.LevelMapper; import com.engine.organization.service.LevelService; +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 com.weaverboot.frame.ioc.anno.classAnno.WeaIocService; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; +import weaver.general.StringUtil; +import weaver.general.Util; -import java.util.Map; +import java.util.*; /** - * - * @description: TODO + * @description: TODO * @author:dxfeng * @createTime: 2022/05/10 * @version: 1.0 */ @WeaIocService public class LevelServiceImpl extends Service implements LevelService { + + private LevelMapper getLevelMapper() { + return MapperProxyFactory.getProxy(LevelMapper.class); + } + @Override public Map listPage(Map params) { - OrganizationWeaTable table = new OrganizationWeaTable<>(user, LevelTableVO.class); + OrganizationWeaTable table = new OrganizationWeaTable<>(user, LevelTableVO.class); String sqlWhere = buildSqlWhere(params); table.setSqlwhere(sqlWhere); WeaResultMsg result = new WeaResultMsg(false); @@ -34,6 +49,92 @@ public class LevelServiceImpl extends Service implements LevelService { return result.getResultMap(); } + + @Override + public int saveLevel(LevelSearchParam param) { + List list = getLevelMapper().listByNo(Util.null2String(param.getLevelNo())); + OrganizationAssert.isEmpty(list, "编号不允许重复"); + LevelPO levelPO = LevelDTO.convertParamToPO(param, (long) user.getUID()); + System.out.println(levelPO); + return getLevelMapper().insertIgnoreNull(levelPO); + } + + @Override + public int updateLevel(LevelSearchParam param) { + LevelPO levelPO = LevelDTO.convertParamToPO(param, (long) user.getUID()); + return getLevelMapper().updateLevel(levelPO); + } + + @Override + public int updateForbiddenTagById(LevelSearchParam params) { + LevelPO levelPO = LevelPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); + return getLevelMapper().updateForbiddenTagById(levelPO); + } + + @Override + public int deleteByIds(Collection ids) { + OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); + return getLevelMapper().deleteByIds(ids); + } + + + @Override + public Map getSearchCondition(Map params) { + Map apiDatas = new HashMap<>(); + List addGroups = new ArrayList<>(); + List conditionItems = new ArrayList<>(); + SearchConditionItem levelNameCondition = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "levelName"); + SearchConditionItem levelNoCondition = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "编号", "levelNo"); + conditionItems.add(levelNameCondition); + conditionItems.add(levelNoCondition); + addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems)); + apiDatas.put("conditions", addGroups); + return apiDatas; + } + + + @Override + public Map getLevelForm(Map params) { + Map apiDatas = new HashMap<>(); + List selectItems = new ArrayList<>(); + List addGroups = new ArrayList<>(); + SearchConditionItem levelNameCondition = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "名称", "levelName"); + levelNameCondition.setRules("required|string"); + SearchConditionItem levelNoCondition = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "编号", "levelNo"); + levelNoCondition.setRules("required|string"); + SearchConditionItem descriptionCondition = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 2, 60, "描述说明", "description"); + + // TODO 浏览按钮 + SearchConditionItem browserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, true, "等级方案", "17", "levelScheme"); + + // 编辑状态下赋值操作 + String id = Util.null2String(params.get("id")); + if (!StringUtil.isEmpty(id)) { + LevelPO levelPO = getLevelMapper().getLevelByID(Integer.parseInt(id)); + OrganizationAssert.notNull(levelPO, "选择的数据不存在,或数据已删除"); + + levelNameCondition.setValue(levelPO.getLevelName()); + levelNoCondition.setValue(levelPO.getLevelNo()); + descriptionCondition.setValue(levelPO.getDescription()); + // TODO 浏览按钮赋值 + // 编辑状态下,编号只读 + levelNoCondition.setViewAttr(1); + } + + selectItems.add(levelNoCondition); + selectItems.add(levelNameCondition); + selectItems.add(descriptionCondition); + selectItems.add(browserItem); + addGroups.add(new SearchConditionGroup("基本信息", true, selectItems)); + apiDatas.put("condition", addGroups); + return apiDatas; + } + + @Override + public Map getTableBtn() { + return MenuBtn.getCommonBtnDatas(); + } + /** * 查询条件 * diff --git a/src/com/engine/organization/service/impl/SchemeServiceImpl.java b/src/com/engine/organization/service/impl/SchemeServiceImpl.java index 66bbadce..3f5b1f1d 100644 --- a/src/com/engine/organization/service/impl/SchemeServiceImpl.java +++ b/src/com/engine/organization/service/impl/SchemeServiceImpl.java @@ -34,6 +34,10 @@ import java.util.*; public class SchemeServiceImpl extends Service implements SchemeService { + private SchemeMapper getSchemeMapper() { + return MapperProxyFactory.getProxy(SchemeMapper.class); + } + @Override public Map listPage(Map params) { OrganizationWeaTable table = new OrganizationWeaTable<>(user, SchemeTableVO.class); @@ -50,38 +54,32 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public Map save(SchemeSearchParam param) { Map apidatas = new HashMap(16); - SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class); - List list = mapper.listByNo(Util.null2String(param.getSchemeNo())); + List list = getSchemeMapper().listByNo(Util.null2String(param.getSchemeNo())); OrganizationAssert.isEmpty(list, "编号不允许重复"); SchemePO schemePO = SchemeDTO.convertParamToPO(param, (long) user.getUID()); - mapper.insertIgnoreNull(schemePO); + getSchemeMapper().insertIgnoreNull(schemePO); return apidatas; } @Override public Map updateScheme(SchemeSearchParam param) { Map apidatas = new HashMap(); - SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class); SchemePO schemePO = SchemeDTO.convertParamToPO(param, (long) user.getUID()); - mapper.updateScheme(schemePO); + getSchemeMapper().updateScheme(schemePO); return apidatas; } @Override public void updateForbiddenTagById(SchemeSearchParam params) { - SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class); SchemePO schemePO = SchemePO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); - mapper.updateForbiddenTagById(schemePO); + getSchemeMapper().updateForbiddenTagById(schemePO); } @Override public void deleteByIds(Collection ids) { OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); - SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class); - List schemePOS = mapper.listSchemesByIds(ids); - OrganizationAssert.notEmpty(schemePOS, "选择的数据不存在,或数据已删除"); - mapper.deleteByIds(ids); + getSchemeMapper().deleteByIds(ids); } @@ -114,8 +112,7 @@ public class SchemeServiceImpl extends Service implements SchemeService { // 编辑状态下赋值操作 String id = Util.null2String(params.get("id")); if (!StringUtil.isEmpty(id)) { - SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class); - SchemePO schemePO = mapper.getSchemeByID(Integer.parseInt(id)); + SchemePO schemePO = getSchemeMapper().getSchemeByID(Integer.parseInt(id)); OrganizationAssert.notNull(schemePO, "选择的数据不存在,或数据已删除"); schemeNameCondition.setValue(schemePO.getSchemeName()); schemeNoCondition.setValue(schemePO.getSchemeNo()); @@ -135,22 +132,7 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public Map getTableBtn() { - Map btnDatas = new HashMap<>(); - ArrayList topMenuList = new ArrayList<>(); - ArrayList rightMenuList = new ArrayList<>(); - // 新建 - 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; + return MenuBtn.getCommonBtnDatas(); } /** diff --git a/src/com/engine/organization/util/MenuBtn.java b/src/com/engine/organization/util/MenuBtn.java index 22d65cc7..ac273b73 100644 --- a/src/com/engine/organization/util/MenuBtn.java +++ b/src/com/engine/organization/util/MenuBtn.java @@ -5,8 +5,11 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + /** - * * @description: MenuBtn工具类 * @author:dxfeng * @createTime: 2022/05/09 @@ -26,44 +29,71 @@ public class MenuBtn { /** * topMenu新增 + * * @return */ - public static MenuBtn topMenu_addNew(){ - return MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建").type( "BTN_Addnew").build(); + public static MenuBtn topMenu_addNew() { + return MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建").type("BTN_Addnew").build(); } /** * topMenu批量删除 + * * @return */ - public static MenuBtn topMenu_batchDelete(){ - return MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建").type( "BTN_Addnew").build(); + public static MenuBtn topMenu_batchDelete() { + return MenuBtn.builder().isBatch("1").isTop("1").menuFun("batchDelete").menuIcon("icon-coms-Batch-delete").menuName("批量删除").type( "BTN_BatchDelete").build(); } /** * rightMenu新增 + * * @return */ - public static MenuBtn rightMenu_addNew(){ - return MenuBtn.builder().isBatch("0").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建").type( "BTN_Addnew").build(); + public static MenuBtn rightMenu_addNew() { + return MenuBtn.builder().isBatch("0").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建").type("BTN_Addnew").build(); } /** * rightMenu日志 + * * @return */ - public static MenuBtn rightMenu_btnLog(){ - return MenuBtn.builder().isBatch("0").isTop("0").menuFun("log").menuIcon("icon-coms-Print-log").menuName("日志").type( "BTN_log").build(); + public static MenuBtn rightMenu_btnLog() { + return MenuBtn.builder().isBatch("0").isTop("0").menuFun("log").menuIcon("icon-coms-Print-log").menuName("日志").type("BTN_log").build(); } /** * rightMenu显示列定制 + * * @return */ - public static MenuBtn rightMenu_btnColumn(){ - return MenuBtn.builder().isBatch("0").isTop("0").menuFun("custom").menuIcon("icon-coms-task-list").menuName("显示列定制").type( "BTN_COLUMN").build(); + public static MenuBtn rightMenu_btnColumn() { + return MenuBtn.builder().isBatch("0").isTop("0").menuFun("custom").menuIcon("icon-coms-task-list").menuName("显示列定制").type("BTN_COLUMN").build(); + } + + /** + * 获取常用按钮列表 + * @return + */ + public static Map getCommonBtnDatas() { + Map btnDatas = new HashMap<>(); + ArrayList topMenuList = new ArrayList<>(); + ArrayList rightMenuList = new ArrayList<>(); + // 新建 + 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; } - } diff --git a/src/com/engine/organization/web/LevelController.java b/src/com/engine/organization/web/LevelController.java index 951fef19..1344761d 100644 --- a/src/com/engine/organization/web/LevelController.java +++ b/src/com/engine/organization/web/LevelController.java @@ -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.QueryParam; +import com.engine.organization.entity.scheme.param.LevelSearchParam; import com.engine.organization.util.response.ReturnResult; import com.engine.organization.wrapper.LevelWrapper; +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; @@ -17,8 +21,7 @@ import javax.ws.rs.core.MediaType; import java.util.Map; /** - * - * @description: TODO + * @description: TODO * @author:dxfeng * @createTime: 2022/05/10 * @version: 1.0 @@ -38,7 +41,7 @@ public class LevelController { @GET @Path("/getLevelTable") @Produces(MediaType.APPLICATION_JSON) - public ReturnResult listScheme(@Context HttpServletRequest request, @Context HttpServletResponse response) { + public ReturnResult listLevel(@Context HttpServletRequest request, @Context HttpServletResponse response) { try { User user = HrmUserVarify.getUser(request, response); Map map = ParamUtil.request2Map(request); @@ -47,4 +50,144 @@ public class LevelController { return ReturnResult.exceptionHandle(e.getMessage()); } } + + /** + * 添加职等 + * + * @param request + * @param response + * @return + */ + @POST + @Path("/saveLevel") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult saveLevel(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LevelSearchParam param) { + try { + User user = HrmUserVarify.getUser(request, response); + return ReturnResult.successed(getLevelWrapper(user).saveLevel(param)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e.getMessage()); + } + } + + /** + * 更新职等,修改所有字段 + * + * @param request + * @param response + * @param param + * @return + */ + @POST + @Path("/updateLevel") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult updateLevel(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LevelSearchParam param) { + try { + User user = HrmUserVarify.getUser(request, response); + return ReturnResult.successed(getLevelWrapper(user).updateLevel(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 LevelSearchParam param) { + try { + User user = HrmUserVarify.getUser(request, response); + return ReturnResult.successed(getLevelWrapper(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(getLevelWrapper(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(getLevelWrapper(user).getSearchCondition(map)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e.getMessage()); + } + } + + + /** + * 新增、编辑表单 + * + * @param request + * @param response + * @return + */ + @GET + @Path("/getLevelForm") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult getLevelForm(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + User user = HrmUserVarify.getUser(request, response); + Map map = ParamUtil.request2Map(request); + return ReturnResult.successed(getLevelWrapper(user).getLevelForm(map)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e.getMessage()); + } + } + + /** + * 列表页顶部按钮 + * + * @param request + * @param response + * @return + */ + @GET + @Path("/getTableBtn") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult getTableBtn(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + User user = HrmUserVarify.getUser(request, response); + return ReturnResult.successed(getLevelWrapper(user).getTableBtn()); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e.getMessage()); + } + } } diff --git a/src/com/engine/organization/wrapper/LevelWrapper.java b/src/com/engine/organization/wrapper/LevelWrapper.java index 528cadae..1e490d3b 100644 --- a/src/com/engine/organization/wrapper/LevelWrapper.java +++ b/src/com/engine/organization/wrapper/LevelWrapper.java @@ -2,15 +2,17 @@ package com.engine.organization.wrapper; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.organization.entity.scheme.param.LevelSearchParam; import com.engine.organization.service.LevelService; import com.engine.organization.service.impl.LevelServiceImpl; +import org.apache.ibatis.annotations.Param; import weaver.hrm.User; +import java.util.Collection; import java.util.Map; /** - * - * @description: TODO + * @description: TODO * @author:dxfeng * @createTime: 2022/05/10 * @version: 1.0 @@ -21,7 +23,7 @@ public class LevelWrapper extends Service { } /** - * 等级方案列表 + * 职等列表 * * @param params * @return @@ -29,4 +31,72 @@ public class LevelWrapper extends Service { public Map listPage(Map params) { return getLevelService(user).listPage(params); } + + /** + * 新增职等 + * + * @param param + * @return + */ + public int saveLevel(LevelSearchParam param) { + return getLevelService(user).saveLevel(param); + } + + /** + * 更新职等 + * + * @param param + * @return + */ + public int updateLevel(LevelSearchParam param) { + return getLevelService(user).updateLevel(param); + } + + /** + * 更新禁用标记 + * + * @param params + */ + public int updateForbiddenTagById(LevelSearchParam params) { + return getLevelService(user).updateForbiddenTagById(params); + } + + /** + * 根据ID批量删除 + * + * @param ids + */ + public int deleteByIds(@Param("ids") Collection ids) { + return getLevelService(user).deleteByIds(ids); + } + + /** + * 获取搜索条件 + * + * @param params + * @return + */ + public Map getSearchCondition(Map params) { + return getLevelService(user).getSearchCondition(params); + } + + + /** + * 获取新增表单 + * + * @param params + * @return + */ + public Map getLevelForm(Map params) { + return getLevelService(user).getLevelForm(params); + } + + /** + * 获取列表页面按钮信息 + * + * @return + */ + public Map getTableBtn() { + return getLevelService(user).getTableBtn(); + } }