等级方案 实体类 查询接口
This commit is contained in:
parent
276247c161
commit
932105a8a0
|
|
@ -33,30 +33,4 @@ import weaver.conn.RecordSet;
|
|||
|
||||
private Integer forbiddenTag;
|
||||
|
||||
|
||||
|
||||
public static String makeSqlWhere(SchemeSearchParam searchParam) {
|
||||
|
||||
String sqlWhere = " 1 = 1 ";
|
||||
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
|
||||
String schemeNo = searchParam.getSchemeNo();
|
||||
if (StringUtils.isNotBlank(schemeNo)) {
|
||||
sqlWhere += " AND t.scheme_no " + dbType.like(schemeNo);
|
||||
}
|
||||
String schemeName = searchParam.getSchemeName();
|
||||
if (StringUtils.isNotBlank(schemeName)) {
|
||||
sqlWhere += " AND t.scheme_name " + dbType.like(schemeName);
|
||||
}
|
||||
String schemeDescription = searchParam.getSchemeDescription();
|
||||
if (schemeDescription != null) {
|
||||
sqlWhere += " AND t.scheme_description = " + schemeDescription;
|
||||
}
|
||||
Integer forbiddenTag = searchParam.getForbiddenTag();
|
||||
if (forbiddenTag != null) {
|
||||
sqlWhere += " AND t.forbidden_tag = " + forbiddenTag;
|
||||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,11 +55,11 @@ public class SchemePO {
|
|||
return null;
|
||||
}
|
||||
return SchemePO.builder()
|
||||
.id(param.get("id") == null ? null : (long) param.get("id"))
|
||||
.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"))
|
||||
.forbiddenTag(param.get("forbidden_tag") == null ? null : (int) param.get("forbidden_tag"))
|
||||
.forbiddenTag(param.get("forbidden_tag") == null ? 0 : Integer.parseInt((String)param.get("forbidden_tag")))
|
||||
.deleteType(0)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
|
|
|
|||
|
|
@ -43,19 +43,20 @@ public class SchemeTableVO {
|
|||
@OrganizationTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
@OrganizationTableColumn(text = "编号", width = "25%", column = "scheme_no")
|
||||
|
||||
@OrganizationTableColumn(text = "编号", width = "25%", column = "schemeNo")
|
||||
private String schemeNo;
|
||||
/**
|
||||
* 方案名称
|
||||
*/
|
||||
@OrganizationTableColumn(text = "方案名称", width = "25%", column = "scheme_name")
|
||||
@OrganizationTableColumn(text = "方案名称", width = "25%", column = "schemeName")
|
||||
private String schemeName;
|
||||
|
||||
//薪资档案引用
|
||||
@OrganizationTableColumn(text = "方案说明", width = "25%", column = "scheme_description")
|
||||
@OrganizationTableColumn(text = "方案说明", width = "25%", column = "schemeDescription")
|
||||
private String schemeDescription;
|
||||
|
||||
//默认使用
|
||||
@OrganizationTableColumn(text = "禁用标记", width = "25%", column = "forbidden_tag")
|
||||
@OrganizationTableColumn(text = "禁用标记", width = "25%", column = "forbiddenTag")
|
||||
private Integer forbiddenTag;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,30 +61,34 @@
|
|||
</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="id != null ">
|
||||
#{id},
|
||||
</if>
|
||||
<if test="schemeNo != null ">
|
||||
#{scheme_no},
|
||||
</if>
|
||||
<if test="schemeName != null ">
|
||||
#{scheme_name},
|
||||
</if>
|
||||
<if test="schemeDescription != null ">
|
||||
#{scheme_description},
|
||||
</if>
|
||||
<if test="forbiddenTag != null ">
|
||||
#{forbidden_tag},
|
||||
</if>
|
||||
<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="id != null ">
|
||||
#{id},
|
||||
</if>
|
||||
<if test="schemeNo != null ">
|
||||
#{schemeNo},
|
||||
</if>
|
||||
<if test="schemeName != null ">
|
||||
#{schemeName},
|
||||
</if>
|
||||
<if test="schemeDescription != null ">
|
||||
#{schemeDescription},
|
||||
</if>
|
||||
<if test="forbiddenTag != null ">
|
||||
#{forbiddenTag},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -8,7 +8,9 @@ import com.engine.organization.entity.scheme.vo.SchemeTableVO;
|
|||
import com.engine.organization.exception.OrganizationRunTimeException;
|
||||
import com.engine.organization.mapper.scheme.SchemeMapper;
|
||||
import com.engine.organization.service.SchemeService;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
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.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -34,29 +36,21 @@ public class SchemeServiceImpl extends Service implements SchemeService {
|
|||
@Override
|
||||
public Map<String, Object> save(Map<String, Object> params) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>(16);
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SchemeMapper mapper = sqlSession.getMapper(SchemeMapper.class);
|
||||
|
||||
List<SchemePO> list = mapper.listByNo(Util.null2String(params.get("scheme_no")));
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
throw new OrganizationRunTimeException("编号不允许重复");
|
||||
}
|
||||
|
||||
SchemePO schemePO = SchemePO.convertToPO(params, (long) user.getUID());
|
||||
mapper.insertIgnoreNull(schemePO);
|
||||
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
SchemeMapper mapper = MapperProxyFactory.getProxy(SchemeMapper.class);
|
||||
List<SchemePO> list = mapper.listByNo(Util.null2String(params.get("scheme_no")));
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
throw new OrganizationRunTimeException("编号不允许重复");
|
||||
}
|
||||
OrganizationAssert.notEmpty(list,"");
|
||||
SchemePO schemePO = SchemePO.convertToPO(params, (long) user.getUID());
|
||||
mapper.insertIgnoreNull(schemePO);
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(Map<String, Object> params) {
|
||||
OrganizationWeaTable<SchemeTableVO> table = new OrganizationWeaTable<>(user,SchemeTableVO.class);
|
||||
OrganizationWeaTable<SchemeTableVO> table = new OrganizationWeaTable<>(user, SchemeTableVO.class);
|
||||
|
||||
String sqlWhere = buildSqlWhere(params);
|
||||
table.setSqlwhere(sqlWhere);
|
||||
|
|
@ -70,6 +64,7 @@ public class SchemeServiceImpl extends Service implements SchemeService {
|
|||
|
||||
/**
|
||||
* 查询条件
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@ package com.engine.organization.web;
|
|||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.scheme.dto.SchemeListDTO;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.SchemeWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -23,6 +26,7 @@ public class SchemeController {
|
|||
|
||||
/**
|
||||
* 获取list列表
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param searchCondition
|
||||
|
|
@ -32,14 +36,20 @@ public class SchemeController {
|
|||
@Path("/getTable")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getTable(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@QueryParam("searchCondition") String searchCondition) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getSchemeWrapper(user).listPage(map));
|
||||
@QueryParam("searchCondition") String searchCondition
|
||||
) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getSchemeWrapper(user).listPage(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加职等职级信息
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
|
|
@ -48,9 +58,13 @@ public class SchemeController {
|
|||
@Path("/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult saveFrom(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> save = getSchemeWrapper(user).save(ParamUtil.request2Map(request));
|
||||
return ReturnResult.successed(save);
|
||||
// try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> save = getSchemeWrapper(user).save(ParamUtil.request2Map(request));
|
||||
return ReturnResult.successed(save);
|
||||
// } catch (Exception e) {
|
||||
// return ReturnResult.exceptionHandle(e.getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue