花名册模板管理查询、编辑保存20230112
This commit is contained in:
parent
044f963f31
commit
a677da06a6
|
|
@ -1,7 +1,9 @@
|
|||
package com.engine.organization.mapper.resource;
|
||||
|
||||
import com.engine.organization.entity.hrmresource.po.JclOrgCustomTemplatePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -26,4 +28,8 @@ public interface JclOrgCustomTemplateMapper {
|
|||
|
||||
List<JclOrgCustomTemplatePO> listAll();
|
||||
|
||||
List<Long> listAllId();
|
||||
|
||||
int deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,4 +117,16 @@
|
|||
update_time = #{updateTime,jdbcType=DATE}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="listAllId" resultType="java.lang.Long">
|
||||
select t.id from jcl_org_custom_template t
|
||||
</select>
|
||||
|
||||
<delete id="deleteByIds">
|
||||
delete from jcl_org_custom_template where id in
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -136,6 +136,14 @@ public interface HrmResourceService {
|
|||
*/
|
||||
Integer saveCustomTemplate(SearchTemplateParam params);
|
||||
|
||||
/**
|
||||
* 批量修改保存定制列模板
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Integer updateCustomTemplate(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 删除定制列模板
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.engine.organization.entity.company.po.CompPO;
|
|||
import com.engine.organization.entity.department.bo.DepartmentBO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.extend.bo.ExtendInfoBO;
|
||||
import com.engine.organization.entity.extend.param.ExtendInfoParams;
|
||||
import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
||||
import com.engine.organization.entity.hrmresource.bo.HrmRelationBO;
|
||||
import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam;
|
||||
|
|
@ -34,6 +35,7 @@ import com.engine.organization.entity.searchtree.SearchTreeParams;
|
|||
import com.engine.organization.enums.HrmGroupEnum;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtMapper;
|
||||
import com.engine.organization.mapper.hrmresource.HrmRelationMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
|
|
@ -43,6 +45,7 @@ import com.engine.organization.service.HrmResourceService;
|
|||
import com.engine.organization.util.HasRightUtil;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.OrganizationDateUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
|
|
@ -57,6 +60,7 @@ import weaver.general.StringUtil;
|
|||
import weaver.general.Util;
|
||||
import weaver.hrm.definedfield.HrmFieldManager;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -249,6 +253,40 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
return templatePO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateCustomTemplate(Map<String, Object> params) {
|
||||
int rowNum = Util.getIntValue((String) params.get("rownum"));
|
||||
int count = 0;
|
||||
List<Long> allIds = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).listAllId();
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
for (int i = 0; i < rowNum; i++) {
|
||||
String recordIndex = "_" + i;
|
||||
String id = Util.null2String(params.get("id" + recordIndex));
|
||||
String name = Util.null2String(params.get("name" + recordIndex));
|
||||
JclOrgCustomTemplatePO jclOrgCustomTemplatePO = new JclOrgCustomTemplatePO();
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
// 更新
|
||||
long jclId = Long.parseLong(id);
|
||||
jclOrgCustomTemplatePO = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).selectByPrimaryKey(jclId);
|
||||
jclOrgCustomTemplatePO.setName(name);
|
||||
jclOrgCustomTemplatePO.setUpdateTime(new java.sql.Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
count += MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).updateByPrimaryKey(jclOrgCustomTemplatePO);
|
||||
allIds.remove(jclId);
|
||||
} else {
|
||||
//插入
|
||||
jclOrgCustomTemplatePO.setName(name);
|
||||
jclOrgCustomTemplatePO.setCreator(user.getUID());
|
||||
jclOrgCustomTemplatePO.setCreateTime(new java.sql.Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
jclOrgCustomTemplatePO.setUpdateTime(new java.sql.Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
||||
count += MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).insert(jclOrgCustomTemplatePO);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(allIds)) {
|
||||
count += MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).deleteByIds(allIds);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCustomTemplate(Integer id) {
|
||||
getHrmResourceMapper().deleteCustomTemplate(id, user.getUID());
|
||||
|
|
@ -451,10 +489,13 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
resultMap.put("name", item.getName());
|
||||
resultMap.put("createTime", item.getCreateTime());
|
||||
|
||||
if (1 == item.getIsused()) {
|
||||
isUsed.add(index.get());
|
||||
if(item.getIsused()!=null){
|
||||
|
||||
if (1 == item.getIsused()) {
|
||||
isUsed.add(index.get());
|
||||
}
|
||||
index.getAndIncrement();
|
||||
}
|
||||
index.getAndIncrement();
|
||||
|
||||
return resultMap;
|
||||
}).collect(Collectors.toList());
|
||||
|
|
|
|||
|
|
@ -332,5 +332,17 @@ public class HrmResourceController {
|
|||
}
|
||||
}
|
||||
|
||||
@Path("/updateCustomTemplate")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult updateCustomTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
Integer templateId = getHrmResourceWrapper(user).updateCustomTemplate(map);
|
||||
return ReturnResult.successed(Util.null2String(templateId));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,10 @@ public class HrmResourceWrapper extends OrganizationWrapper {
|
|||
return getHrmResourceService(user).saveCustomTemplate(params);
|
||||
}
|
||||
|
||||
public Integer updateCustomTemplate(Map<String, Object> params) {
|
||||
return getHrmResourceService(user).updateCustomTemplate(params);
|
||||
}
|
||||
|
||||
public void deleteCustomTemplate(Integer id) {
|
||||
getHrmResourceService(user).deleteCustomTemplate(id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue