14 changed files with 1927 additions and 287 deletions
-
300xm-core/src/main/java/com/xm/core/ctrl/XmBudgetLaborController.java
-
300xm-core/src/main/java/com/xm/core/ctrl/XmBudgetNlaborController.java
-
300xm-core/src/main/java/com/xm/core/ctrl/XmCostNlaborController.java
-
84xm-core/src/main/java/com/xm/core/entity/XmBudgetLabor.java
-
75xm-core/src/main/java/com/xm/core/entity/XmBudgetNlabor.java
-
96xm-core/src/main/java/com/xm/core/entity/XmCostNlabor.java
-
287xm-core/src/main/java/com/xm/core/entity/XmProjectMCostNouser.java
-
24xm-core/src/main/java/com/xm/core/service/XmBudgetLaborService.java
-
24xm-core/src/main/java/com/xm/core/service/XmBudgetNlaborService.java
-
24xm-core/src/main/java/com/xm/core/service/XmCostNlaborService.java
-
220xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmBudgetLaborMapper.xml
-
208xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmBudgetNlaborMapper.xml
-
236xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmCostNlaborMapper.xml
-
36xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMCostNouserMapper.xml
@ -0,0 +1,300 @@ |
|||||
|
package com.xm.core.ctrl; |
||||
|
|
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import io.swagger.annotations.ApiResponse; |
||||
|
import io.swagger.annotations.ApiResponses; |
||||
|
|
||||
|
import static com.mdp.core.utils.ResponseHelper.*; |
||||
|
import static com.mdp.core.utils.BaseUtils.*; |
||||
|
import com.mdp.core.entity.Tips; |
||||
|
import com.mdp.core.err.BizException; |
||||
|
import com.mdp.mybatis.PageUtils; |
||||
|
import com.mdp.core.utils.RequestUtils; |
||||
|
import com.mdp.core.utils.NumberUtil; |
||||
|
import com.mdp.safe.client.entity.User; |
||||
|
import com.mdp.safe.client.utils.LoginUtils; |
||||
|
import com.mdp.swagger.ApiEntityParams; |
||||
|
import springfox.documentation.annotations.ApiIgnore; |
||||
|
|
||||
|
import com.xm.core.service.XmBudgetLaborService; |
||||
|
import com.xm.core.entity.XmBudgetLabor; |
||||
|
|
||||
|
/** |
||||
|
* url编制采用rest风格,如对xm_budget_labor 项目人力成本预算的操作有增删改查,对应的url分别为:<br> |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmBudgetLabor 表 xm_budget_labor 当前主键(包括多主键): id; |
||||
|
***/ |
||||
|
@RestController("xm.core.xmBudgetLaborController") |
||||
|
@RequestMapping(value="/**/core/xmBudgetLabor") |
||||
|
@Api(tags={"项目人力成本预算操作接口"}) |
||||
|
public class XmBudgetLaborController { |
||||
|
|
||||
|
static Logger logger =LoggerFactory.getLogger(XmBudgetLaborController.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private XmBudgetLaborService xmBudgetLaborService; |
||||
|
|
||||
|
|
||||
|
Map<String,Object> fieldsMap = toMap(new XmBudgetLabor()); |
||||
|
|
||||
|
|
||||
|
@ApiOperation( value = "查询项目人力成本预算信息列表",notes=" ") |
||||
|
@ApiEntityParams( XmBudgetLabor.class ) |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name="pageSize",value="每页大小,默认20条",required=false), |
||||
|
@ApiImplicitParam(name="pageNum",value="当前页码,从1开始",required=false), |
||||
|
@ApiImplicitParam(name="total",value="总记录数,服务器端收到0时,会自动计算总记录数,如果上传>0的不自动计算",required=false), |
||||
|
@ApiImplicitParam(name="count",value="是否计算总记录条数,如果count=true,则计算计算总条数,如果count=false 则不计算",required=false), |
||||
|
@ApiImplicitParam(name="orderBy",value="排序列 如性别、学生编号排序 orderBy = sex desc,student desc",required=false), |
||||
|
}) |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmBudgetLabor.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
||||
|
}) |
||||
|
@RequestMapping(value="/list",method=RequestMethod.GET) |
||||
|
public Map<String,Object> listXmBudgetLabor( @ApiIgnore @RequestParam Map<String,Object> xmBudgetLabor){ |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("查询成功"); |
||||
|
RequestUtils.transformArray(xmBudgetLabor, "ids"); |
||||
|
PageUtils.startPage(xmBudgetLabor); |
||||
|
List<Map<String,Object>> xmBudgetLaborList = xmBudgetLaborService.selectListMapByWhere(xmBudgetLabor); //列出XmBudgetLabor列表 |
||||
|
PageUtils.responePage(m, xmBudgetLaborList); |
||||
|
m.put("data",xmBudgetLaborList); |
||||
|
|
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "新增一条项目人力成本预算信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmBudgetLabor.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/add",method=RequestMethod.POST) |
||||
|
public Map<String,Object> addXmBudgetLabor(@RequestBody XmBudgetLabor xmBudgetLabor) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功新增一条数据"); |
||||
|
try{ |
||||
|
boolean createPk=false; |
||||
|
if(!StringUtils.hasText(xmBudgetLabor.getId())) { |
||||
|
createPk=true; |
||||
|
xmBudgetLabor.setId(xmBudgetLaborService.createKey("id")); |
||||
|
} |
||||
|
if(createPk==false){ |
||||
|
if(xmBudgetLaborService.selectOneObject(xmBudgetLabor) !=null ){ |
||||
|
return failed("pk-exists","编号重复,请修改编号再提交"); |
||||
|
} |
||||
|
} |
||||
|
xmBudgetLaborService.insert(xmBudgetLabor); |
||||
|
m.put("data",xmBudgetLabor); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "删除一条项目人力成本预算信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") |
||||
|
}) |
||||
|
@RequestMapping(value="/del",method=RequestMethod.POST) |
||||
|
public Map<String,Object> delXmBudgetLabor(@RequestBody XmBudgetLabor xmBudgetLabor){ |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功删除一条数据"); |
||||
|
try{ |
||||
|
if(!StringUtils.hasText(xmBudgetLabor.getId())) { |
||||
|
return failed("pk-not-exists","请上送主键参数id"); |
||||
|
} |
||||
|
XmBudgetLabor xmBudgetLaborDb = xmBudgetLaborService.selectOneObject(xmBudgetLabor); |
||||
|
if( xmBudgetLaborDb == null ){ |
||||
|
return failed("data-not-exists","数据不存在,无法删除"); |
||||
|
} |
||||
|
xmBudgetLaborService.deleteByPk(xmBudgetLabor); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "根据主键修改一条项目人力成本预算信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmBudgetLabor.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/edit",method=RequestMethod.POST) |
||||
|
public Map<String,Object> editXmBudgetLabor(@RequestBody XmBudgetLabor xmBudgetLabor) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功更新一条数据"); |
||||
|
try{ |
||||
|
if(!StringUtils.hasText(xmBudgetLabor.getId())) { |
||||
|
return failed("pk-not-exists","请上送主键参数id"); |
||||
|
} |
||||
|
XmBudgetLabor xmBudgetLaborDb = xmBudgetLaborService.selectOneObject(xmBudgetLabor); |
||||
|
if( xmBudgetLaborDb == null ){ |
||||
|
return failed("data-not-exists","数据不存在,无法修改"); |
||||
|
} |
||||
|
xmBudgetLaborService.updateSomeFieldByPk(xmBudgetLabor); |
||||
|
m.put("data",xmBudgetLabor); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "批量修改某些字段",notes="") |
||||
|
@ApiEntityParams( value = XmBudgetLabor.class, props={ }, remark = "项目人力成本预算", paramType = "body" ) |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmBudgetLabor.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/editSomeFields",method=RequestMethod.POST) |
||||
|
public Map<String,Object> editSomeFields( @ApiIgnore @RequestBody Map<String,Object> xmBudgetLaborMap) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功更新一条数据"); |
||||
|
try{ |
||||
|
List<String> ids= (List<String>) xmBudgetLaborMap.get("ids"); |
||||
|
if(ids==null || ids.size()==0){ |
||||
|
return failed("ids-0","ids不能为空"); |
||||
|
} |
||||
|
|
||||
|
Set<String> fields=new HashSet<>(); |
||||
|
fields.add("id"); |
||||
|
for (String fieldName : xmBudgetLaborMap.keySet()) { |
||||
|
if(fields.contains(fieldName)){ |
||||
|
return failed(fieldName+"-no-edit",fieldName+"不允许修改"); |
||||
|
} |
||||
|
} |
||||
|
Set<String> fieldKey=xmBudgetLaborMap.keySet().stream().filter(i-> fieldsMap.containsKey(i)).collect(Collectors.toSet()); |
||||
|
fieldKey=fieldKey.stream().filter(i->!StringUtils.isEmpty(xmBudgetLaborMap.get(i) )).collect(Collectors.toSet()); |
||||
|
|
||||
|
if(fieldKey.size()<=0) { |
||||
|
return failed("fieldKey-0","没有需要更新的字段"); |
||||
|
} |
||||
|
XmBudgetLabor xmBudgetLabor = fromMap(xmBudgetLaborMap,XmBudgetLabor.class); |
||||
|
List<XmBudgetLabor> xmBudgetLaborsDb=xmBudgetLaborService.selectListByIds(ids); |
||||
|
if(xmBudgetLaborsDb==null ||xmBudgetLaborsDb.size()==0){ |
||||
|
return failed("data-0","记录已不存在"); |
||||
|
} |
||||
|
List<XmBudgetLabor> can=new ArrayList<>(); |
||||
|
List<XmBudgetLabor> no=new ArrayList<>(); |
||||
|
User user = LoginUtils.getCurrentUserInfo(); |
||||
|
for (XmBudgetLabor xmBudgetLaborDb : xmBudgetLaborsDb) { |
||||
|
Tips tips2 = new Tips("检查通过"); |
||||
|
if(!tips2.isOk()){ |
||||
|
no.add(xmBudgetLaborDb); |
||||
|
}else{ |
||||
|
can.add(xmBudgetLaborDb); |
||||
|
} |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
xmBudgetLaborMap.put("ids",can.stream().map(i->i.getId()).collect(Collectors.toList())); |
||||
|
xmBudgetLaborService.editSomeFields(xmBudgetLaborMap); |
||||
|
} |
||||
|
List<String> msgs=new ArrayList<>(); |
||||
|
if(can.size()>0){ |
||||
|
msgs.add(String.format("成功更新以下%s条数据",can.size())); |
||||
|
} |
||||
|
if(no.size()>0){ |
||||
|
msgs.add(String.format("以下%s个数据无权限更新",no.size())); |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
tips.setOkMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
}else { |
||||
|
tips.setFailureMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
} |
||||
|
//m.put("data",xmMenu); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "根据主键列表批量删除项目人力成本预算信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") |
||||
|
}) |
||||
|
@RequestMapping(value="/batchDel",method=RequestMethod.POST) |
||||
|
public Map<String,Object> batchDelXmBudgetLabor(@RequestBody List<XmBudgetLabor> xmBudgetLabors) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功删除"); |
||||
|
try{ |
||||
|
if(xmBudgetLabors.size()<=0){ |
||||
|
return failed("data-0","请上送待删除数据列表"); |
||||
|
} |
||||
|
List<XmBudgetLabor> datasDb=xmBudgetLaborService.selectListByIds(xmBudgetLabors.stream().map(i-> i.getId() ).collect(Collectors.toList())); |
||||
|
|
||||
|
List<XmBudgetLabor> can=new ArrayList<>(); |
||||
|
List<XmBudgetLabor> no=new ArrayList<>(); |
||||
|
for (XmBudgetLabor data : datasDb) { |
||||
|
if(true){ |
||||
|
can.add(data); |
||||
|
}else{ |
||||
|
no.add(data); |
||||
|
} |
||||
|
} |
||||
|
List<String> msgs=new ArrayList<>(); |
||||
|
if(can.size()>0){ |
||||
|
xmBudgetLaborService.batchDelete(xmBudgetLabors); |
||||
|
msgs.add(String.format("成功删除%s条数据.",can.size())); |
||||
|
} |
||||
|
|
||||
|
if(no.size()>0){ |
||||
|
msgs.add(String.format("以下%s条数据不能删除.【%s】",no.size(),no.stream().map(i-> i.getId() ).collect(Collectors.joining(",")))); |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
tips.setOkMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
}else { |
||||
|
tips.setFailureMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
} |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
} |
||||
@ -0,0 +1,300 @@ |
|||||
|
package com.xm.core.ctrl; |
||||
|
|
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import io.swagger.annotations.ApiResponse; |
||||
|
import io.swagger.annotations.ApiResponses; |
||||
|
|
||||
|
import static com.mdp.core.utils.ResponseHelper.*; |
||||
|
import static com.mdp.core.utils.BaseUtils.*; |
||||
|
import com.mdp.core.entity.Tips; |
||||
|
import com.mdp.core.err.BizException; |
||||
|
import com.mdp.mybatis.PageUtils; |
||||
|
import com.mdp.core.utils.RequestUtils; |
||||
|
import com.mdp.core.utils.NumberUtil; |
||||
|
import com.mdp.safe.client.entity.User; |
||||
|
import com.mdp.safe.client.utils.LoginUtils; |
||||
|
import com.mdp.swagger.ApiEntityParams; |
||||
|
import springfox.documentation.annotations.ApiIgnore; |
||||
|
|
||||
|
import com.xm.core.service.XmBudgetNlaborService; |
||||
|
import com.xm.core.entity.XmBudgetNlabor; |
||||
|
|
||||
|
/** |
||||
|
* url编制采用rest风格,如对xm_budget_nlabor 项目人力成本预算的操作有增删改查,对应的url分别为:<br> |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmBudgetNlabor 表 xm_budget_nlabor 当前主键(包括多主键): id; |
||||
|
***/ |
||||
|
@RestController("xm.core.xmBudgetNlaborController") |
||||
|
@RequestMapping(value="/**/core/xmBudgetNlabor") |
||||
|
@Api(tags={"项目人力成本预算操作接口"}) |
||||
|
public class XmBudgetNlaborController { |
||||
|
|
||||
|
static Logger logger =LoggerFactory.getLogger(XmBudgetNlaborController.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private XmBudgetNlaborService xmBudgetNlaborService; |
||||
|
|
||||
|
|
||||
|
Map<String,Object> fieldsMap = toMap(new XmBudgetNlabor()); |
||||
|
|
||||
|
|
||||
|
@ApiOperation( value = "查询项目人力成本预算信息列表",notes=" ") |
||||
|
@ApiEntityParams( XmBudgetNlabor.class ) |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name="pageSize",value="每页大小,默认20条",required=false), |
||||
|
@ApiImplicitParam(name="pageNum",value="当前页码,从1开始",required=false), |
||||
|
@ApiImplicitParam(name="total",value="总记录数,服务器端收到0时,会自动计算总记录数,如果上传>0的不自动计算",required=false), |
||||
|
@ApiImplicitParam(name="count",value="是否计算总记录条数,如果count=true,则计算计算总条数,如果count=false 则不计算",required=false), |
||||
|
@ApiImplicitParam(name="orderBy",value="排序列 如性别、学生编号排序 orderBy = sex desc,student desc",required=false), |
||||
|
}) |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmBudgetNlabor.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
||||
|
}) |
||||
|
@RequestMapping(value="/list",method=RequestMethod.GET) |
||||
|
public Map<String,Object> listXmBudgetNlabor( @ApiIgnore @RequestParam Map<String,Object> xmBudgetNlabor){ |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("查询成功"); |
||||
|
RequestUtils.transformArray(xmBudgetNlabor, "ids"); |
||||
|
PageUtils.startPage(xmBudgetNlabor); |
||||
|
List<Map<String,Object>> xmBudgetNlaborList = xmBudgetNlaborService.selectListMapByWhere(xmBudgetNlabor); //列出XmBudgetNlabor列表 |
||||
|
PageUtils.responePage(m, xmBudgetNlaborList); |
||||
|
m.put("data",xmBudgetNlaborList); |
||||
|
|
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "新增一条项目人力成本预算信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmBudgetNlabor.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/add",method=RequestMethod.POST) |
||||
|
public Map<String,Object> addXmBudgetNlabor(@RequestBody XmBudgetNlabor xmBudgetNlabor) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功新增一条数据"); |
||||
|
try{ |
||||
|
boolean createPk=false; |
||||
|
if(!StringUtils.hasText(xmBudgetNlabor.getId())) { |
||||
|
createPk=true; |
||||
|
xmBudgetNlabor.setId(xmBudgetNlaborService.createKey("id")); |
||||
|
} |
||||
|
if(createPk==false){ |
||||
|
if(xmBudgetNlaborService.selectOneObject(xmBudgetNlabor) !=null ){ |
||||
|
return failed("pk-exists","编号重复,请修改编号再提交"); |
||||
|
} |
||||
|
} |
||||
|
xmBudgetNlaborService.insert(xmBudgetNlabor); |
||||
|
m.put("data",xmBudgetNlabor); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "删除一条项目人力成本预算信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") |
||||
|
}) |
||||
|
@RequestMapping(value="/del",method=RequestMethod.POST) |
||||
|
public Map<String,Object> delXmBudgetNlabor(@RequestBody XmBudgetNlabor xmBudgetNlabor){ |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功删除一条数据"); |
||||
|
try{ |
||||
|
if(!StringUtils.hasText(xmBudgetNlabor.getId())) { |
||||
|
return failed("pk-not-exists","请上送主键参数id"); |
||||
|
} |
||||
|
XmBudgetNlabor xmBudgetNlaborDb = xmBudgetNlaborService.selectOneObject(xmBudgetNlabor); |
||||
|
if( xmBudgetNlaborDb == null ){ |
||||
|
return failed("data-not-exists","数据不存在,无法删除"); |
||||
|
} |
||||
|
xmBudgetNlaborService.deleteByPk(xmBudgetNlabor); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "根据主键修改一条项目人力成本预算信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmBudgetNlabor.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/edit",method=RequestMethod.POST) |
||||
|
public Map<String,Object> editXmBudgetNlabor(@RequestBody XmBudgetNlabor xmBudgetNlabor) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功更新一条数据"); |
||||
|
try{ |
||||
|
if(!StringUtils.hasText(xmBudgetNlabor.getId())) { |
||||
|
return failed("pk-not-exists","请上送主键参数id"); |
||||
|
} |
||||
|
XmBudgetNlabor xmBudgetNlaborDb = xmBudgetNlaborService.selectOneObject(xmBudgetNlabor); |
||||
|
if( xmBudgetNlaborDb == null ){ |
||||
|
return failed("data-not-exists","数据不存在,无法修改"); |
||||
|
} |
||||
|
xmBudgetNlaborService.updateSomeFieldByPk(xmBudgetNlabor); |
||||
|
m.put("data",xmBudgetNlabor); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "批量修改某些字段",notes="") |
||||
|
@ApiEntityParams( value = XmBudgetNlabor.class, props={ }, remark = "项目人力成本预算", paramType = "body" ) |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmBudgetNlabor.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/editSomeFields",method=RequestMethod.POST) |
||||
|
public Map<String,Object> editSomeFields( @ApiIgnore @RequestBody Map<String,Object> xmBudgetNlaborMap) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功更新一条数据"); |
||||
|
try{ |
||||
|
List<String> ids= (List<String>) xmBudgetNlaborMap.get("ids"); |
||||
|
if(ids==null || ids.size()==0){ |
||||
|
return failed("ids-0","ids不能为空"); |
||||
|
} |
||||
|
|
||||
|
Set<String> fields=new HashSet<>(); |
||||
|
fields.add("id"); |
||||
|
for (String fieldName : xmBudgetNlaborMap.keySet()) { |
||||
|
if(fields.contains(fieldName)){ |
||||
|
return failed(fieldName+"-no-edit",fieldName+"不允许修改"); |
||||
|
} |
||||
|
} |
||||
|
Set<String> fieldKey=xmBudgetNlaborMap.keySet().stream().filter(i-> fieldsMap.containsKey(i)).collect(Collectors.toSet()); |
||||
|
fieldKey=fieldKey.stream().filter(i->!StringUtils.isEmpty(xmBudgetNlaborMap.get(i) )).collect(Collectors.toSet()); |
||||
|
|
||||
|
if(fieldKey.size()<=0) { |
||||
|
return failed("fieldKey-0","没有需要更新的字段"); |
||||
|
} |
||||
|
XmBudgetNlabor xmBudgetNlabor = fromMap(xmBudgetNlaborMap,XmBudgetNlabor.class); |
||||
|
List<XmBudgetNlabor> xmBudgetNlaborsDb=xmBudgetNlaborService.selectListByIds(ids); |
||||
|
if(xmBudgetNlaborsDb==null ||xmBudgetNlaborsDb.size()==0){ |
||||
|
return failed("data-0","记录已不存在"); |
||||
|
} |
||||
|
List<XmBudgetNlabor> can=new ArrayList<>(); |
||||
|
List<XmBudgetNlabor> no=new ArrayList<>(); |
||||
|
User user = LoginUtils.getCurrentUserInfo(); |
||||
|
for (XmBudgetNlabor xmBudgetNlaborDb : xmBudgetNlaborsDb) { |
||||
|
Tips tips2 = new Tips("检查通过"); |
||||
|
if(!tips2.isOk()){ |
||||
|
no.add(xmBudgetNlaborDb); |
||||
|
}else{ |
||||
|
can.add(xmBudgetNlaborDb); |
||||
|
} |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
xmBudgetNlaborMap.put("ids",can.stream().map(i->i.getId()).collect(Collectors.toList())); |
||||
|
xmBudgetNlaborService.editSomeFields(xmBudgetNlaborMap); |
||||
|
} |
||||
|
List<String> msgs=new ArrayList<>(); |
||||
|
if(can.size()>0){ |
||||
|
msgs.add(String.format("成功更新以下%s条数据",can.size())); |
||||
|
} |
||||
|
if(no.size()>0){ |
||||
|
msgs.add(String.format("以下%s个数据无权限更新",no.size())); |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
tips.setOkMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
}else { |
||||
|
tips.setFailureMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
} |
||||
|
//m.put("data",xmMenu); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "根据主键列表批量删除项目人力成本预算信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") |
||||
|
}) |
||||
|
@RequestMapping(value="/batchDel",method=RequestMethod.POST) |
||||
|
public Map<String,Object> batchDelXmBudgetNlabor(@RequestBody List<XmBudgetNlabor> xmBudgetNlabors) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功删除"); |
||||
|
try{ |
||||
|
if(xmBudgetNlabors.size()<=0){ |
||||
|
return failed("data-0","请上送待删除数据列表"); |
||||
|
} |
||||
|
List<XmBudgetNlabor> datasDb=xmBudgetNlaborService.selectListByIds(xmBudgetNlabors.stream().map(i-> i.getId() ).collect(Collectors.toList())); |
||||
|
|
||||
|
List<XmBudgetNlabor> can=new ArrayList<>(); |
||||
|
List<XmBudgetNlabor> no=new ArrayList<>(); |
||||
|
for (XmBudgetNlabor data : datasDb) { |
||||
|
if(true){ |
||||
|
can.add(data); |
||||
|
}else{ |
||||
|
no.add(data); |
||||
|
} |
||||
|
} |
||||
|
List<String> msgs=new ArrayList<>(); |
||||
|
if(can.size()>0){ |
||||
|
xmBudgetNlaborService.batchDelete(xmBudgetNlabors); |
||||
|
msgs.add(String.format("成功删除%s条数据.",can.size())); |
||||
|
} |
||||
|
|
||||
|
if(no.size()>0){ |
||||
|
msgs.add(String.format("以下%s条数据不能删除.【%s】",no.size(),no.stream().map(i-> i.getId() ).collect(Collectors.joining(",")))); |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
tips.setOkMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
}else { |
||||
|
tips.setFailureMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
} |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
} |
||||
@ -0,0 +1,300 @@ |
|||||
|
package com.xm.core.ctrl; |
||||
|
|
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import io.swagger.annotations.ApiResponse; |
||||
|
import io.swagger.annotations.ApiResponses; |
||||
|
|
||||
|
import static com.mdp.core.utils.ResponseHelper.*; |
||||
|
import static com.mdp.core.utils.BaseUtils.*; |
||||
|
import com.mdp.core.entity.Tips; |
||||
|
import com.mdp.core.err.BizException; |
||||
|
import com.mdp.mybatis.PageUtils; |
||||
|
import com.mdp.core.utils.RequestUtils; |
||||
|
import com.mdp.core.utils.NumberUtil; |
||||
|
import com.mdp.safe.client.entity.User; |
||||
|
import com.mdp.safe.client.utils.LoginUtils; |
||||
|
import com.mdp.swagger.ApiEntityParams; |
||||
|
import springfox.documentation.annotations.ApiIgnore; |
||||
|
|
||||
|
import com.xm.core.service.XmCostNlaborService; |
||||
|
import com.xm.core.entity.XmCostNlabor; |
||||
|
|
||||
|
/** |
||||
|
* url编制采用rest风格,如对xm_cost_nlabor 项目实际人工成本费用的操作有增删改查,对应的url分别为:<br> |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmCostNlabor 表 xm_cost_nlabor 当前主键(包括多主键): id; |
||||
|
***/ |
||||
|
@RestController("xm.core.xmCostNlaborController") |
||||
|
@RequestMapping(value="/**/core/xmCostNlabor") |
||||
|
@Api(tags={"项目实际人工成本费用操作接口"}) |
||||
|
public class XmCostNlaborController { |
||||
|
|
||||
|
static Logger logger =LoggerFactory.getLogger(XmCostNlaborController.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private XmCostNlaborService xmCostNlaborService; |
||||
|
|
||||
|
|
||||
|
Map<String,Object> fieldsMap = toMap(new XmCostNlabor()); |
||||
|
|
||||
|
|
||||
|
@ApiOperation( value = "查询项目实际人工成本费用信息列表",notes=" ") |
||||
|
@ApiEntityParams( XmCostNlabor.class ) |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name="pageSize",value="每页大小,默认20条",required=false), |
||||
|
@ApiImplicitParam(name="pageNum",value="当前页码,从1开始",required=false), |
||||
|
@ApiImplicitParam(name="total",value="总记录数,服务器端收到0时,会自动计算总记录数,如果上传>0的不自动计算",required=false), |
||||
|
@ApiImplicitParam(name="count",value="是否计算总记录条数,如果count=true,则计算计算总条数,如果count=false 则不计算",required=false), |
||||
|
@ApiImplicitParam(name="orderBy",value="排序列 如性别、学生编号排序 orderBy = sex desc,student desc",required=false), |
||||
|
}) |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmCostNlabor.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
||||
|
}) |
||||
|
@RequestMapping(value="/list",method=RequestMethod.GET) |
||||
|
public Map<String,Object> listXmCostNlabor( @ApiIgnore @RequestParam Map<String,Object> xmCostNlabor){ |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("查询成功"); |
||||
|
RequestUtils.transformArray(xmCostNlabor, "ids"); |
||||
|
PageUtils.startPage(xmCostNlabor); |
||||
|
List<Map<String,Object>> xmCostNlaborList = xmCostNlaborService.selectListMapByWhere(xmCostNlabor); //列出XmCostNlabor列表 |
||||
|
PageUtils.responePage(m, xmCostNlaborList); |
||||
|
m.put("data",xmCostNlaborList); |
||||
|
|
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "新增一条项目实际人工成本费用信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmCostNlabor.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/add",method=RequestMethod.POST) |
||||
|
public Map<String,Object> addXmCostNlabor(@RequestBody XmCostNlabor xmCostNlabor) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功新增一条数据"); |
||||
|
try{ |
||||
|
boolean createPk=false; |
||||
|
if(!StringUtils.hasText(xmCostNlabor.getId())) { |
||||
|
createPk=true; |
||||
|
xmCostNlabor.setId(xmCostNlaborService.createKey("id")); |
||||
|
} |
||||
|
if(createPk==false){ |
||||
|
if(xmCostNlaborService.selectOneObject(xmCostNlabor) !=null ){ |
||||
|
return failed("pk-exists","编号重复,请修改编号再提交"); |
||||
|
} |
||||
|
} |
||||
|
xmCostNlaborService.insert(xmCostNlabor); |
||||
|
m.put("data",xmCostNlabor); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "删除一条项目实际人工成本费用信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") |
||||
|
}) |
||||
|
@RequestMapping(value="/del",method=RequestMethod.POST) |
||||
|
public Map<String,Object> delXmCostNlabor(@RequestBody XmCostNlabor xmCostNlabor){ |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功删除一条数据"); |
||||
|
try{ |
||||
|
if(!StringUtils.hasText(xmCostNlabor.getId())) { |
||||
|
return failed("pk-not-exists","请上送主键参数id"); |
||||
|
} |
||||
|
XmCostNlabor xmCostNlaborDb = xmCostNlaborService.selectOneObject(xmCostNlabor); |
||||
|
if( xmCostNlaborDb == null ){ |
||||
|
return failed("data-not-exists","数据不存在,无法删除"); |
||||
|
} |
||||
|
xmCostNlaborService.deleteByPk(xmCostNlabor); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "根据主键修改一条项目实际人工成本费用信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmCostNlabor.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/edit",method=RequestMethod.POST) |
||||
|
public Map<String,Object> editXmCostNlabor(@RequestBody XmCostNlabor xmCostNlabor) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功更新一条数据"); |
||||
|
try{ |
||||
|
if(!StringUtils.hasText(xmCostNlabor.getId())) { |
||||
|
return failed("pk-not-exists","请上送主键参数id"); |
||||
|
} |
||||
|
XmCostNlabor xmCostNlaborDb = xmCostNlaborService.selectOneObject(xmCostNlabor); |
||||
|
if( xmCostNlaborDb == null ){ |
||||
|
return failed("data-not-exists","数据不存在,无法修改"); |
||||
|
} |
||||
|
xmCostNlaborService.updateSomeFieldByPk(xmCostNlabor); |
||||
|
m.put("data",xmCostNlabor); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "批量修改某些字段",notes="") |
||||
|
@ApiEntityParams( value = XmCostNlabor.class, props={ }, remark = "项目实际人工成本费用", paramType = "body" ) |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmCostNlabor.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/editSomeFields",method=RequestMethod.POST) |
||||
|
public Map<String,Object> editSomeFields( @ApiIgnore @RequestBody Map<String,Object> xmCostNlaborMap) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功更新一条数据"); |
||||
|
try{ |
||||
|
List<String> ids= (List<String>) xmCostNlaborMap.get("ids"); |
||||
|
if(ids==null || ids.size()==0){ |
||||
|
return failed("ids-0","ids不能为空"); |
||||
|
} |
||||
|
|
||||
|
Set<String> fields=new HashSet<>(); |
||||
|
fields.add("id"); |
||||
|
for (String fieldName : xmCostNlaborMap.keySet()) { |
||||
|
if(fields.contains(fieldName)){ |
||||
|
return failed(fieldName+"-no-edit",fieldName+"不允许修改"); |
||||
|
} |
||||
|
} |
||||
|
Set<String> fieldKey=xmCostNlaborMap.keySet().stream().filter(i-> fieldsMap.containsKey(i)).collect(Collectors.toSet()); |
||||
|
fieldKey=fieldKey.stream().filter(i->!StringUtils.isEmpty(xmCostNlaborMap.get(i) )).collect(Collectors.toSet()); |
||||
|
|
||||
|
if(fieldKey.size()<=0) { |
||||
|
return failed("fieldKey-0","没有需要更新的字段"); |
||||
|
} |
||||
|
XmCostNlabor xmCostNlabor = fromMap(xmCostNlaborMap,XmCostNlabor.class); |
||||
|
List<XmCostNlabor> xmCostNlaborsDb=xmCostNlaborService.selectListByIds(ids); |
||||
|
if(xmCostNlaborsDb==null ||xmCostNlaborsDb.size()==0){ |
||||
|
return failed("data-0","记录已不存在"); |
||||
|
} |
||||
|
List<XmCostNlabor> can=new ArrayList<>(); |
||||
|
List<XmCostNlabor> no=new ArrayList<>(); |
||||
|
User user = LoginUtils.getCurrentUserInfo(); |
||||
|
for (XmCostNlabor xmCostNlaborDb : xmCostNlaborsDb) { |
||||
|
Tips tips2 = new Tips("检查通过"); |
||||
|
if(!tips2.isOk()){ |
||||
|
no.add(xmCostNlaborDb); |
||||
|
}else{ |
||||
|
can.add(xmCostNlaborDb); |
||||
|
} |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
xmCostNlaborMap.put("ids",can.stream().map(i->i.getId()).collect(Collectors.toList())); |
||||
|
xmCostNlaborService.editSomeFields(xmCostNlaborMap); |
||||
|
} |
||||
|
List<String> msgs=new ArrayList<>(); |
||||
|
if(can.size()>0){ |
||||
|
msgs.add(String.format("成功更新以下%s条数据",can.size())); |
||||
|
} |
||||
|
if(no.size()>0){ |
||||
|
msgs.add(String.format("以下%s个数据无权限更新",no.size())); |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
tips.setOkMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
}else { |
||||
|
tips.setFailureMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
} |
||||
|
//m.put("data",xmMenu); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "根据主键列表批量删除项目实际人工成本费用信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") |
||||
|
}) |
||||
|
@RequestMapping(value="/batchDel",method=RequestMethod.POST) |
||||
|
public Map<String,Object> batchDelXmCostNlabor(@RequestBody List<XmCostNlabor> xmCostNlabors) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功删除"); |
||||
|
try{ |
||||
|
if(xmCostNlabors.size()<=0){ |
||||
|
return failed("data-0","请上送待删除数据列表"); |
||||
|
} |
||||
|
List<XmCostNlabor> datasDb=xmCostNlaborService.selectListByIds(xmCostNlabors.stream().map(i-> i.getId() ).collect(Collectors.toList())); |
||||
|
|
||||
|
List<XmCostNlabor> can=new ArrayList<>(); |
||||
|
List<XmCostNlabor> no=new ArrayList<>(); |
||||
|
for (XmCostNlabor data : datasDb) { |
||||
|
if(true){ |
||||
|
can.add(data); |
||||
|
}else{ |
||||
|
no.add(data); |
||||
|
} |
||||
|
} |
||||
|
List<String> msgs=new ArrayList<>(); |
||||
|
if(can.size()>0){ |
||||
|
xmCostNlaborService.batchDelete(xmCostNlabors); |
||||
|
msgs.add(String.format("成功删除%s条数据.",can.size())); |
||||
|
} |
||||
|
|
||||
|
if(no.size()>0){ |
||||
|
msgs.add(String.format("以下%s条数据不能删除.【%s】",no.size(),no.stream().map(i-> i.getId() ).collect(Collectors.joining(",")))); |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
tips.setOkMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
}else { |
||||
|
tips.setFailureMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
} |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
} |
||||
@ -0,0 +1,84 @@ |
|||||
|
package com.xm.core.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmBudgetLabor所有属性名: <br> |
||||
|
* "projectId","项目编号","userid","项目成员编号","budgetAt","预算金额/每月","id","主键","remark","备注","username","用户名","subjectId","预算科目编号","bizSdate","费用归属周期开始日期","bizEdate","费用归属周期结束日期","bizMonth","费用归属月份yyyy-mm","instId","当前流程实例编号","bizFlowState","当前流程状态0初始1审批中2审批通过3审批不通过4流程取消或者删除","costType","成本类型0非人力1内部人力2外购人力","subjectName","科目名称","branchId","项目归属机构编号","ubranchId","用户归属机构编号-也就是将来的结算对象";<br> |
||||
|
* 当前主键(包括多主键):<br> |
||||
|
* id;<br> |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(description="项目人力成本预算") |
||||
|
public class XmBudgetLabor implements java.io.Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@ApiModelProperty(notes="主键,主键",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String id; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty(notes="项目编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String projectId; |
||||
|
|
||||
|
@ApiModelProperty(notes="项目成员编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String userid; |
||||
|
|
||||
|
@ApiModelProperty(notes="预算金额/每月",allowEmptyValue=true,example="",allowableValues="") |
||||
|
BigDecimal budgetAt; |
||||
|
|
||||
|
@ApiModelProperty(notes="备注",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String remark; |
||||
|
|
||||
|
@ApiModelProperty(notes="用户名",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String username; |
||||
|
|
||||
|
@ApiModelProperty(notes="预算科目编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String subjectId; |
||||
|
|
||||
|
@ApiModelProperty(notes="费用归属周期开始日期",allowEmptyValue=true,example="",allowableValues="") |
||||
|
Date bizSdate; |
||||
|
|
||||
|
@ApiModelProperty(notes="费用归属周期结束日期",allowEmptyValue=true,example="",allowableValues="") |
||||
|
Date bizEdate; |
||||
|
|
||||
|
@ApiModelProperty(notes="费用归属月份yyyy-mm",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String bizMonth; |
||||
|
|
||||
|
@ApiModelProperty(notes="当前流程实例编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String instId; |
||||
|
|
||||
|
@ApiModelProperty(notes="当前流程状态0初始1审批中2审批通过3审批不通过4流程取消或者删除",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String bizFlowState; |
||||
|
|
||||
|
@ApiModelProperty(notes="成本类型0非人力1内部人力2外购人力",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String costType; |
||||
|
|
||||
|
@ApiModelProperty(notes="科目名称",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String subjectName; |
||||
|
|
||||
|
@ApiModelProperty(notes="项目归属机构编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String branchId; |
||||
|
|
||||
|
@ApiModelProperty(notes="用户归属机构编号-也就是将来的结算对象",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String ubranchId; |
||||
|
|
||||
|
/** |
||||
|
*主键 |
||||
|
**/ |
||||
|
public XmBudgetLabor(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 项目人力成本预算 |
||||
|
**/ |
||||
|
public XmBudgetLabor() { |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,75 @@ |
|||||
|
package com.xm.core.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmBudgetNlabor所有属性名: <br> |
||||
|
* "id","主键","projectId","项目编号","budgetAt","预算金额","remark","备注","subjectId","预算科目","bizSdate","费用归属周期开始日期","bizEdate","费用归属周期结束日期","instId","当前流程实例编号","bizFlowState","当前流程状态0初始1审批中2审批通过3审批不通过4流程取消或者删除","costType","成本类型0非人力1内部人力2外购人力","bizMonth","费用归属月份yyyy-MM","subjectName","科目名称","branchId","项目归属企业编号";<br> |
||||
|
* 当前主键(包括多主键):<br> |
||||
|
* id;<br> |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(description="项目人力成本预算") |
||||
|
public class XmBudgetNlabor implements java.io.Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@ApiModelProperty(notes="主键,主键",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String id; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty(notes="项目编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String projectId; |
||||
|
|
||||
|
@ApiModelProperty(notes="预算金额",allowEmptyValue=true,example="",allowableValues="") |
||||
|
BigDecimal budgetAt; |
||||
|
|
||||
|
@ApiModelProperty(notes="备注",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String remark; |
||||
|
|
||||
|
@ApiModelProperty(notes="预算科目",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String subjectId; |
||||
|
|
||||
|
@ApiModelProperty(notes="费用归属周期开始日期",allowEmptyValue=true,example="",allowableValues="") |
||||
|
Date bizSdate; |
||||
|
|
||||
|
@ApiModelProperty(notes="费用归属周期结束日期",allowEmptyValue=true,example="",allowableValues="") |
||||
|
Date bizEdate; |
||||
|
|
||||
|
@ApiModelProperty(notes="当前流程实例编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String instId; |
||||
|
|
||||
|
@ApiModelProperty(notes="当前流程状态0初始1审批中2审批通过3审批不通过4流程取消或者删除",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String bizFlowState; |
||||
|
|
||||
|
@ApiModelProperty(notes="成本类型0非人力1内部人力2外购人力",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String costType; |
||||
|
|
||||
|
@ApiModelProperty(notes="费用归属月份yyyy-MM",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String bizMonth; |
||||
|
|
||||
|
@ApiModelProperty(notes="科目名称",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String subjectName; |
||||
|
|
||||
|
@ApiModelProperty(notes="项目归属企业编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String branchId; |
||||
|
|
||||
|
/** |
||||
|
*主键 |
||||
|
**/ |
||||
|
public XmBudgetNlabor(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 项目人力成本预算 |
||||
|
**/ |
||||
|
public XmBudgetNlabor() { |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,96 @@ |
|||||
|
package com.xm.core.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import java.util.Date; |
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmCostNlabor所有属性名: <br> |
||||
|
* "projectId","项目编号","userid","用户编号-费用主责人","ctime","创建时间","sendTime","费用发放时间","username","用户名称","projectName","项目名称","remark","备注","id","主键","taskId","任务编号","taskName","任务名称","subjectId","科目编号","bizSdate","费用归属周期开始日期","bizEdate","费用归属周期结束日期","actAt","实际成本金额","costType","成本类型0非人力1内部人力2外购人力,此表都是非人力","bizMonth","业务归属月份yyyy-MM","bizDate","业务归属日期yyyy-MM-dd","subjectName","科目名称","ubranchId","用户归属机构","branchId","项目归属机构";<br> |
||||
|
* 当前主键(包括多主键):<br> |
||||
|
* id;<br> |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(description="项目实际人工成本费用") |
||||
|
public class XmCostNlabor implements java.io.Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@ApiModelProperty(notes="主键,主键",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String id; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty(notes="项目编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String projectId; |
||||
|
|
||||
|
@ApiModelProperty(notes="用户编号-费用主责人",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String userid; |
||||
|
|
||||
|
@ApiModelProperty(notes="创建时间",allowEmptyValue=true,example="",allowableValues="") |
||||
|
Date ctime; |
||||
|
|
||||
|
@ApiModelProperty(notes="费用发放时间",allowEmptyValue=true,example="",allowableValues="") |
||||
|
Date sendTime; |
||||
|
|
||||
|
@ApiModelProperty(notes="用户名称",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String username; |
||||
|
|
||||
|
@ApiModelProperty(notes="项目名称",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String projectName; |
||||
|
|
||||
|
@ApiModelProperty(notes="备注",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String remark; |
||||
|
|
||||
|
@ApiModelProperty(notes="任务编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String taskId; |
||||
|
|
||||
|
@ApiModelProperty(notes="任务名称",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String taskName; |
||||
|
|
||||
|
@ApiModelProperty(notes="科目编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String subjectId; |
||||
|
|
||||
|
@ApiModelProperty(notes="费用归属周期开始日期",allowEmptyValue=true,example="",allowableValues="") |
||||
|
Date bizSdate; |
||||
|
|
||||
|
@ApiModelProperty(notes="费用归属周期结束日期",allowEmptyValue=true,example="",allowableValues="") |
||||
|
Date bizEdate; |
||||
|
|
||||
|
@ApiModelProperty(notes="实际成本金额",allowEmptyValue=true,example="",allowableValues="") |
||||
|
BigDecimal actAt; |
||||
|
|
||||
|
@ApiModelProperty(notes="成本类型0非人力1内部人力2外购人力,此表都是非人力",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String costType; |
||||
|
|
||||
|
@ApiModelProperty(notes="业务归属月份yyyy-MM",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String bizMonth; |
||||
|
|
||||
|
@ApiModelProperty(notes="业务归属日期yyyy-MM-dd",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String bizDate; |
||||
|
|
||||
|
@ApiModelProperty(notes="科目名称",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String subjectName; |
||||
|
|
||||
|
@ApiModelProperty(notes="用户归属机构",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String ubranchId; |
||||
|
|
||||
|
@ApiModelProperty(notes="项目归属机构",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String branchId; |
||||
|
|
||||
|
/** |
||||
|
*主键 |
||||
|
**/ |
||||
|
public XmCostNlabor(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 项目实际人工成本费用 |
||||
|
**/ |
||||
|
public XmCostNlabor() { |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.xm.core.service; |
||||
|
|
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.mdp.core.service.BaseService; |
||||
|
import static com.mdp.core.utils.BaseUtils.*; |
||||
|
import com.mdp.core.entity.Tips; |
||||
|
import com.mdp.core.err.BizException; |
||||
|
|
||||
|
import com.xm.core.entity.XmBudgetLabor; |
||||
|
/** |
||||
|
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br> |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmBudgetLabor 表 xm_budget_labor 当前主键(包括多主键): id; |
||||
|
***/ |
||||
|
@Service("xm.core.xmBudgetLaborService") |
||||
|
public class XmBudgetLaborService extends BaseService { |
||||
|
static Logger logger =LoggerFactory.getLogger(XmBudgetLaborService.class); |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.xm.core.service; |
||||
|
|
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.mdp.core.service.BaseService; |
||||
|
import static com.mdp.core.utils.BaseUtils.*; |
||||
|
import com.mdp.core.entity.Tips; |
||||
|
import com.mdp.core.err.BizException; |
||||
|
|
||||
|
import com.xm.core.entity.XmBudgetNlabor; |
||||
|
/** |
||||
|
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br> |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmBudgetNlabor 表 xm_budget_nlabor 当前主键(包括多主键): id; |
||||
|
***/ |
||||
|
@Service("xm.core.xmBudgetNlaborService") |
||||
|
public class XmBudgetNlaborService extends BaseService { |
||||
|
static Logger logger =LoggerFactory.getLogger(XmBudgetNlaborService.class); |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.xm.core.service; |
||||
|
|
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.mdp.core.service.BaseService; |
||||
|
import static com.mdp.core.utils.BaseUtils.*; |
||||
|
import com.mdp.core.entity.Tips; |
||||
|
import com.mdp.core.err.BizException; |
||||
|
|
||||
|
import com.xm.core.entity.XmCostNlabor; |
||||
|
/** |
||||
|
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br> |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmCostNlabor 表 xm_cost_nlabor 当前主键(包括多主键): id; |
||||
|
***/ |
||||
|
@Service("xm.core.xmCostNlaborService") |
||||
|
public class XmCostNlaborService extends BaseService { |
||||
|
static Logger logger =LoggerFactory.getLogger(XmCostNlaborService.class); |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,220 @@ |
|||||
|
<?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.xm.core.entity.XmBudgetLabor"> |
||||
|
|
||||
|
|
||||
|
<!--开始 自定sql函数区域 请在此区域添加自定义函数,其它区域尽量不要动,因为代码随时重新生成 --> |
||||
|
|
||||
|
<sql id="whereForMap"> |
||||
|
<if test=" ids != null"> and (res.id) in |
||||
|
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</if> |
||||
|
<if test="key != null and key !='' "> </if> |
||||
|
</sql> |
||||
|
|
||||
|
|
||||
|
<!--结束 自定义sql函数区域--> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<!-- 通过条件查询获取数据列表 返回list<map> --> |
||||
|
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap"> |
||||
|
select * from xm_budget_labor res |
||||
|
<where> |
||||
|
<include refid="whereForMap"/> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> --> |
||||
|
<select id="selectListByWhere" parameterType="com.xm.core.entity.XmBudgetLabor" resultType="com.xm.core.entity.XmBudgetLabor"> |
||||
|
select * from xm_budget_labor res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 通过主键查询获取数据对象 返回object --> |
||||
|
<select id="selectOneObject" parameterType="com.xm.core.entity.XmBudgetLabor" resultType="com.xm.core.entity.XmBudgetLabor"> |
||||
|
select * from xm_budget_labor res |
||||
|
where |
||||
|
res.id = #{id} |
||||
|
</select> |
||||
|
<select id="selectListByIds" parameterType="List" resultType="com.xm.core.entity.XmBudgetLabor"> |
||||
|
select * from xm_budget_labor res |
||||
|
where (res.id) in |
||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</select> |
||||
|
<!-- 通过主键查询获取数据对象 返回map--> |
||||
|
<select id="selectOneMap" parameterType="HashMap" resultType="HashMap"> |
||||
|
select * from xm_budget_labor res |
||||
|
where |
||||
|
res.id = #{id} |
||||
|
</select> |
||||
|
<!-- 获取数据条目 返回long --> |
||||
|
<select id="countByWhere" parameterType="com.xm.core.entity.XmBudgetLabor" resultType="long"> |
||||
|
select count(*) from xm_budget_labor res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
<!-- 新增一条记录 主键id,--> |
||||
|
<insert id="insert" parameterType="com.xm.core.entity.XmBudgetLabor" useGeneratedKeys="false" keyProperty="id"> |
||||
|
insert into xm_budget_labor( |
||||
|
<include refid="columns"/> |
||||
|
) values ( |
||||
|
#{projectId},#{userid},#{budgetAt},#{id},#{remark},#{username},#{subjectId},#{bizSdate},#{bizEdate},#{bizMonth},#{instId},#{bizFlowState},#{costType},#{subjectName},#{branchId},#{ubranchId} |
||||
|
) |
||||
|
</insert> |
||||
|
|
||||
|
<!-- 按条件删除若干条记录--> |
||||
|
<delete id="deleteByWhere" parameterType="com.xm.core.entity.XmBudgetLabor"> |
||||
|
delete from xm_budget_labor res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</delete> |
||||
|
|
||||
|
<!-- 按主键删除一条记录--> |
||||
|
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmBudgetLabor"> |
||||
|
delete from xm_budget_labor |
||||
|
where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
<!-- 根据条件修改若干条记录 --> |
||||
|
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmBudgetLabor"> |
||||
|
update xm_budget_labor |
||||
|
<set> |
||||
|
<include refid="someFieldSet"/> |
||||
|
</set> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<!-- 根据主键修改一条记录 --> |
||||
|
<update id="updateByPk" parameterType="com.xm.core.entity.XmBudgetLabor"> |
||||
|
update xm_budget_labor |
||||
|
<set> |
||||
|
<include refid="set"/> |
||||
|
</set> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<!-- 批量新增 批量插入 借用insert 循环插入实现 |
||||
|
<insert id="batchInsert" parameterType="List"> |
||||
|
</insert> |
||||
|
--> |
||||
|
|
||||
|
<!-- 批量更新 --> |
||||
|
<update id="batchUpdate" parameterType="List"> |
||||
|
<foreach collection="list" item="item" index="index" separator=";" > |
||||
|
update xm_budget_labor |
||||
|
set |
||||
|
<include refid="batchSet"/> |
||||
|
where id = #{item.id} |
||||
|
</foreach> |
||||
|
</update> |
||||
|
|
||||
|
<!-- 批量修改某几个字段 --> |
||||
|
<delete id="editSomeFields" parameterType="HashMap"> |
||||
|
update xm_budget_labor |
||||
|
<set> |
||||
|
<include refid="someFieldSet"/> |
||||
|
</set> |
||||
|
where (id) in |
||||
|
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
<!-- 批量删除 --> |
||||
|
<delete id="batchDelete" parameterType="List"> |
||||
|
delete from xm_budget_labor |
||||
|
where |
||||
|
(id) in |
||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item.id} ) |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
|
||||
|
<!--sql片段 列--> |
||||
|
<sql id="columns"> |
||||
|
project_id,userid,budget_at,id,remark,username,subject_id,biz_sdate,biz_edate,biz_month,inst_id,biz_flow_state,cost_type,subject_name,branch_id,ubranch_id |
||||
|
</sql> |
||||
|
|
||||
|
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS--> |
||||
|
<sql id="where"> |
||||
|
<if test="projectId != null and projectId != ''"> and res.project_id = #{projectId} </if> |
||||
|
<if test="userid != null and userid != ''"> and res.userid = #{userid} </if> |
||||
|
<if test="budgetAt != null and budgetAt != ''"> and res.budget_at = #{budgetAt} </if> |
||||
|
<if test="id != null and id != ''"> and res.id = #{id} </if> |
||||
|
<if test="remark != null and remark != ''"> and res.remark = #{remark} </if> |
||||
|
<if test="username != null and username != ''"> and res.username = #{username} </if> |
||||
|
<if test="subjectId != null and subjectId != ''"> and res.subject_id = #{subjectId} </if> |
||||
|
<if test="bizSdate != null"> and date_format(res.biz_sdate,'%Y-%m-%d') = date_format(#{bizSdate},'%Y-%m-%d') </if> |
||||
|
<if test="bizEdate != null"> and date_format(res.biz_edate,'%Y-%m-%d') = date_format(#{bizEdate},'%Y-%m-%d') </if> |
||||
|
<if test="bizMonth != null and bizMonth != ''"> and res.biz_month = #{bizMonth} </if> |
||||
|
<if test="instId != null and instId != ''"> and res.inst_id = #{instId} </if> |
||||
|
<if test="bizFlowState != null and bizFlowState != ''"> and res.biz_flow_state = #{bizFlowState} </if> |
||||
|
<if test="costType != null and costType != ''"> and res.cost_type = #{costType} </if> |
||||
|
<if test="subjectName != null and subjectName != ''"> and res.subject_name = #{subjectName} </if> |
||||
|
<if test="branchId != null and branchId != ''"> and res.branch_id = #{branchId} </if> |
||||
|
<if test="ubranchId != null and ubranchId != ''"> and res.ubranch_id = #{ubranchId} </if> |
||||
|
</sql> |
||||
|
<!--sql片段 更新字段 --> |
||||
|
<sql id="set"> |
||||
|
project_id = #{projectId}, |
||||
|
userid = #{userid}, |
||||
|
budget_at = #{budgetAt}, |
||||
|
remark = #{remark}, |
||||
|
username = #{username}, |
||||
|
subject_id = #{subjectId}, |
||||
|
biz_sdate = #{bizSdate}, |
||||
|
biz_edate = #{bizEdate}, |
||||
|
biz_month = #{bizMonth}, |
||||
|
inst_id = #{instId}, |
||||
|
biz_flow_state = #{bizFlowState}, |
||||
|
cost_type = #{costType}, |
||||
|
subject_name = #{subjectName}, |
||||
|
branch_id = #{branchId}, |
||||
|
ubranch_id = #{ubranchId} |
||||
|
</sql> |
||||
|
<sql id="someFieldSet"> |
||||
|
<if test="projectId != null and projectId != ''"> project_id = #{projectId}, </if> |
||||
|
<if test="userid != null and userid != ''"> userid = #{userid}, </if> |
||||
|
<if test="budgetAt != null and budgetAt != ''"> budget_at = #{budgetAt}, </if> |
||||
|
<if test="remark != null and remark != ''"> remark = #{remark}, </if> |
||||
|
<if test="username != null and username != ''"> username = #{username}, </if> |
||||
|
<if test="subjectId != null and subjectId != ''"> subject_id = #{subjectId}, </if> |
||||
|
<if test="bizSdate != null"> biz_sdate = #{bizSdate}, </if> |
||||
|
<if test="bizEdate != null"> biz_edate = #{bizEdate}, </if> |
||||
|
<if test="bizMonth != null and bizMonth != ''"> biz_month = #{bizMonth}, </if> |
||||
|
<if test="instId != null and instId != ''"> inst_id = #{instId}, </if> |
||||
|
<if test="bizFlowState != null and bizFlowState != ''"> biz_flow_state = #{bizFlowState}, </if> |
||||
|
<if test="costType != null and costType != ''"> cost_type = #{costType}, </if> |
||||
|
<if test="subjectName != null and subjectName != ''"> subject_name = #{subjectName}, </if> |
||||
|
<if test="branchId != null and branchId != ''"> branch_id = #{branchId}, </if> |
||||
|
<if test="ubranchId != null and ubranchId != ''"> ubranch_id = #{ubranchId}, </if> |
||||
|
</sql> |
||||
|
<!--sql片段 批量更新 --> |
||||
|
<sql id="batchSet"> |
||||
|
project_id = #{item.projectId}, |
||||
|
userid = #{item.userid}, |
||||
|
budget_at = #{item.budgetAt}, |
||||
|
remark = #{item.remark}, |
||||
|
username = #{item.username}, |
||||
|
subject_id = #{item.subjectId}, |
||||
|
biz_sdate = #{item.bizSdate}, |
||||
|
biz_edate = #{item.bizEdate}, |
||||
|
biz_month = #{item.bizMonth}, |
||||
|
inst_id = #{item.instId}, |
||||
|
biz_flow_state = #{item.bizFlowState}, |
||||
|
cost_type = #{item.costType}, |
||||
|
subject_name = #{item.subjectName}, |
||||
|
branch_id = #{item.branchId}, |
||||
|
ubranch_id = #{item.ubranchId} |
||||
|
</sql> |
||||
|
</mapper> |
||||
@ -0,0 +1,208 @@ |
|||||
|
<?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.xm.core.entity.XmBudgetNlabor"> |
||||
|
|
||||
|
|
||||
|
<!--开始 自定sql函数区域 请在此区域添加自定义函数,其它区域尽量不要动,因为代码随时重新生成 --> |
||||
|
|
||||
|
<sql id="whereForMap"> |
||||
|
<if test=" ids != null"> and (res.id) in |
||||
|
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</if> |
||||
|
<if test="key != null and key !='' "> </if> |
||||
|
</sql> |
||||
|
|
||||
|
|
||||
|
<!--结束 自定义sql函数区域--> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<!-- 通过条件查询获取数据列表 返回list<map> --> |
||||
|
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap"> |
||||
|
select * from xm_budget_nlabor res |
||||
|
<where> |
||||
|
<include refid="whereForMap"/> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> --> |
||||
|
<select id="selectListByWhere" parameterType="com.xm.core.entity.XmBudgetNlabor" resultType="com.xm.core.entity.XmBudgetNlabor"> |
||||
|
select * from xm_budget_nlabor res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 通过主键查询获取数据对象 返回object --> |
||||
|
<select id="selectOneObject" parameterType="com.xm.core.entity.XmBudgetNlabor" resultType="com.xm.core.entity.XmBudgetNlabor"> |
||||
|
select * from xm_budget_nlabor res |
||||
|
where |
||||
|
res.id = #{id} |
||||
|
</select> |
||||
|
<select id="selectListByIds" parameterType="List" resultType="com.xm.core.entity.XmBudgetNlabor"> |
||||
|
select * from xm_budget_nlabor res |
||||
|
where (res.id) in |
||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</select> |
||||
|
<!-- 通过主键查询获取数据对象 返回map--> |
||||
|
<select id="selectOneMap" parameterType="HashMap" resultType="HashMap"> |
||||
|
select * from xm_budget_nlabor res |
||||
|
where |
||||
|
res.id = #{id} |
||||
|
</select> |
||||
|
<!-- 获取数据条目 返回long --> |
||||
|
<select id="countByWhere" parameterType="com.xm.core.entity.XmBudgetNlabor" resultType="long"> |
||||
|
select count(*) from xm_budget_nlabor res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
<!-- 新增一条记录 主键id,--> |
||||
|
<insert id="insert" parameterType="com.xm.core.entity.XmBudgetNlabor" useGeneratedKeys="false" keyProperty="id"> |
||||
|
insert into xm_budget_nlabor( |
||||
|
<include refid="columns"/> |
||||
|
) values ( |
||||
|
#{id},#{projectId},#{budgetAt},#{remark},#{subjectId},#{bizSdate},#{bizEdate},#{instId},#{bizFlowState},#{costType},#{bizMonth},#{subjectName},#{branchId} |
||||
|
) |
||||
|
</insert> |
||||
|
|
||||
|
<!-- 按条件删除若干条记录--> |
||||
|
<delete id="deleteByWhere" parameterType="com.xm.core.entity.XmBudgetNlabor"> |
||||
|
delete from xm_budget_nlabor res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</delete> |
||||
|
|
||||
|
<!-- 按主键删除一条记录--> |
||||
|
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmBudgetNlabor"> |
||||
|
delete from xm_budget_nlabor |
||||
|
where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
<!-- 根据条件修改若干条记录 --> |
||||
|
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmBudgetNlabor"> |
||||
|
update xm_budget_nlabor |
||||
|
<set> |
||||
|
<include refid="someFieldSet"/> |
||||
|
</set> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<!-- 根据主键修改一条记录 --> |
||||
|
<update id="updateByPk" parameterType="com.xm.core.entity.XmBudgetNlabor"> |
||||
|
update xm_budget_nlabor |
||||
|
<set> |
||||
|
<include refid="set"/> |
||||
|
</set> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<!-- 批量新增 批量插入 借用insert 循环插入实现 |
||||
|
<insert id="batchInsert" parameterType="List"> |
||||
|
</insert> |
||||
|
--> |
||||
|
|
||||
|
<!-- 批量更新 --> |
||||
|
<update id="batchUpdate" parameterType="List"> |
||||
|
<foreach collection="list" item="item" index="index" separator=";" > |
||||
|
update xm_budget_nlabor |
||||
|
set |
||||
|
<include refid="batchSet"/> |
||||
|
where id = #{item.id} |
||||
|
</foreach> |
||||
|
</update> |
||||
|
|
||||
|
<!-- 批量修改某几个字段 --> |
||||
|
<delete id="editSomeFields" parameterType="HashMap"> |
||||
|
update xm_budget_nlabor |
||||
|
<set> |
||||
|
<include refid="someFieldSet"/> |
||||
|
</set> |
||||
|
where (id) in |
||||
|
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
<!-- 批量删除 --> |
||||
|
<delete id="batchDelete" parameterType="List"> |
||||
|
delete from xm_budget_nlabor |
||||
|
where |
||||
|
(id) in |
||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item.id} ) |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
|
||||
|
<!--sql片段 列--> |
||||
|
<sql id="columns"> |
||||
|
id,project_id,budget_at,remark,subject_id,biz_sdate,biz_edate,inst_id,biz_flow_state,cost_type,biz_month,subject_name,branch_id |
||||
|
</sql> |
||||
|
|
||||
|
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS--> |
||||
|
<sql id="where"> |
||||
|
<if test="id != null and id != ''"> and res.id = #{id} </if> |
||||
|
<if test="projectId != null and projectId != ''"> and res.project_id = #{projectId} </if> |
||||
|
<if test="budgetAt != null and budgetAt != ''"> and res.budget_at = #{budgetAt} </if> |
||||
|
<if test="remark != null and remark != ''"> and res.remark = #{remark} </if> |
||||
|
<if test="subjectId != null and subjectId != ''"> and res.subject_id = #{subjectId} </if> |
||||
|
<if test="bizSdate != null"> and date_format(res.biz_sdate,'%Y-%m-%d') = date_format(#{bizSdate},'%Y-%m-%d') </if> |
||||
|
<if test="bizEdate != null"> and date_format(res.biz_edate,'%Y-%m-%d') = date_format(#{bizEdate},'%Y-%m-%d') </if> |
||||
|
<if test="instId != null and instId != ''"> and res.inst_id = #{instId} </if> |
||||
|
<if test="bizFlowState != null and bizFlowState != ''"> and res.biz_flow_state = #{bizFlowState} </if> |
||||
|
<if test="costType != null and costType != ''"> and res.cost_type = #{costType} </if> |
||||
|
<if test="bizMonth != null and bizMonth != ''"> and res.biz_month = #{bizMonth} </if> |
||||
|
<if test="subjectName != null and subjectName != ''"> and res.subject_name = #{subjectName} </if> |
||||
|
<if test="branchId != null and branchId != ''"> and res.branch_id = #{branchId} </if> |
||||
|
</sql> |
||||
|
<!--sql片段 更新字段 --> |
||||
|
<sql id="set"> |
||||
|
project_id = #{projectId}, |
||||
|
budget_at = #{budgetAt}, |
||||
|
remark = #{remark}, |
||||
|
subject_id = #{subjectId}, |
||||
|
biz_sdate = #{bizSdate}, |
||||
|
biz_edate = #{bizEdate}, |
||||
|
inst_id = #{instId}, |
||||
|
biz_flow_state = #{bizFlowState}, |
||||
|
cost_type = #{costType}, |
||||
|
biz_month = #{bizMonth}, |
||||
|
subject_name = #{subjectName}, |
||||
|
branch_id = #{branchId} |
||||
|
</sql> |
||||
|
<sql id="someFieldSet"> |
||||
|
<if test="projectId != null and projectId != ''"> project_id = #{projectId}, </if> |
||||
|
<if test="budgetAt != null and budgetAt != ''"> budget_at = #{budgetAt}, </if> |
||||
|
<if test="remark != null and remark != ''"> remark = #{remark}, </if> |
||||
|
<if test="subjectId != null and subjectId != ''"> subject_id = #{subjectId}, </if> |
||||
|
<if test="bizSdate != null"> biz_sdate = #{bizSdate}, </if> |
||||
|
<if test="bizEdate != null"> biz_edate = #{bizEdate}, </if> |
||||
|
<if test="instId != null and instId != ''"> inst_id = #{instId}, </if> |
||||
|
<if test="bizFlowState != null and bizFlowState != ''"> biz_flow_state = #{bizFlowState}, </if> |
||||
|
<if test="costType != null and costType != ''"> cost_type = #{costType}, </if> |
||||
|
<if test="bizMonth != null and bizMonth != ''"> biz_month = #{bizMonth}, </if> |
||||
|
<if test="subjectName != null and subjectName != ''"> subject_name = #{subjectName}, </if> |
||||
|
<if test="branchId != null and branchId != ''"> branch_id = #{branchId}, </if> |
||||
|
</sql> |
||||
|
<!--sql片段 批量更新 --> |
||||
|
<sql id="batchSet"> |
||||
|
project_id = #{item.projectId}, |
||||
|
budget_at = #{item.budgetAt}, |
||||
|
remark = #{item.remark}, |
||||
|
subject_id = #{item.subjectId}, |
||||
|
biz_sdate = #{item.bizSdate}, |
||||
|
biz_edate = #{item.bizEdate}, |
||||
|
inst_id = #{item.instId}, |
||||
|
biz_flow_state = #{item.bizFlowState}, |
||||
|
cost_type = #{item.costType}, |
||||
|
biz_month = #{item.bizMonth}, |
||||
|
subject_name = #{item.subjectName}, |
||||
|
branch_id = #{item.branchId} |
||||
|
</sql> |
||||
|
</mapper> |
||||
@ -0,0 +1,236 @@ |
|||||
|
<?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.xm.core.entity.XmCostNlabor"> |
||||
|
|
||||
|
|
||||
|
<!--开始 自定sql函数区域 请在此区域添加自定义函数,其它区域尽量不要动,因为代码随时重新生成 --> |
||||
|
|
||||
|
<sql id="whereForMap"> |
||||
|
<if test=" ids != null"> and (res.id) in |
||||
|
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</if> |
||||
|
<if test="key != null and key !='' "> </if> |
||||
|
</sql> |
||||
|
|
||||
|
|
||||
|
<!--结束 自定义sql函数区域--> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<!-- 通过条件查询获取数据列表 返回list<map> --> |
||||
|
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap"> |
||||
|
select * from xm_cost_nlabor res |
||||
|
<where> |
||||
|
<include refid="whereForMap"/> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> --> |
||||
|
<select id="selectListByWhere" parameterType="com.xm.core.entity.XmCostNlabor" resultType="com.xm.core.entity.XmCostNlabor"> |
||||
|
select * from xm_cost_nlabor res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 通过主键查询获取数据对象 返回object --> |
||||
|
<select id="selectOneObject" parameterType="com.xm.core.entity.XmCostNlabor" resultType="com.xm.core.entity.XmCostNlabor"> |
||||
|
select * from xm_cost_nlabor res |
||||
|
where |
||||
|
res.id = #{id} |
||||
|
</select> |
||||
|
<select id="selectListByIds" parameterType="List" resultType="com.xm.core.entity.XmCostNlabor"> |
||||
|
select * from xm_cost_nlabor res |
||||
|
where (res.id) in |
||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</select> |
||||
|
<!-- 通过主键查询获取数据对象 返回map--> |
||||
|
<select id="selectOneMap" parameterType="HashMap" resultType="HashMap"> |
||||
|
select * from xm_cost_nlabor res |
||||
|
where |
||||
|
res.id = #{id} |
||||
|
</select> |
||||
|
<!-- 获取数据条目 返回long --> |
||||
|
<select id="countByWhere" parameterType="com.xm.core.entity.XmCostNlabor" resultType="long"> |
||||
|
select count(*) from xm_cost_nlabor res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
<!-- 新增一条记录 主键id,--> |
||||
|
<insert id="insert" parameterType="com.xm.core.entity.XmCostNlabor" useGeneratedKeys="false" keyProperty="id"> |
||||
|
insert into xm_cost_nlabor( |
||||
|
<include refid="columns"/> |
||||
|
) values ( |
||||
|
#{projectId},#{userid},#{ctime},#{sendTime},#{username},#{projectName},#{remark},#{id},#{taskId},#{taskName},#{subjectId},#{bizSdate},#{bizEdate},#{actAt},#{costType},#{bizMonth},#{bizDate},#{subjectName},#{ubranchId},#{branchId} |
||||
|
) |
||||
|
</insert> |
||||
|
|
||||
|
<!-- 按条件删除若干条记录--> |
||||
|
<delete id="deleteByWhere" parameterType="com.xm.core.entity.XmCostNlabor"> |
||||
|
delete from xm_cost_nlabor res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</delete> |
||||
|
|
||||
|
<!-- 按主键删除一条记录--> |
||||
|
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmCostNlabor"> |
||||
|
delete from xm_cost_nlabor |
||||
|
where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
<!-- 根据条件修改若干条记录 --> |
||||
|
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmCostNlabor"> |
||||
|
update xm_cost_nlabor |
||||
|
<set> |
||||
|
<include refid="someFieldSet"/> |
||||
|
</set> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<!-- 根据主键修改一条记录 --> |
||||
|
<update id="updateByPk" parameterType="com.xm.core.entity.XmCostNlabor"> |
||||
|
update xm_cost_nlabor |
||||
|
<set> |
||||
|
<include refid="set"/> |
||||
|
</set> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<!-- 批量新增 批量插入 借用insert 循环插入实现 |
||||
|
<insert id="batchInsert" parameterType="List"> |
||||
|
</insert> |
||||
|
--> |
||||
|
|
||||
|
<!-- 批量更新 --> |
||||
|
<update id="batchUpdate" parameterType="List"> |
||||
|
<foreach collection="list" item="item" index="index" separator=";" > |
||||
|
update xm_cost_nlabor |
||||
|
set |
||||
|
<include refid="batchSet"/> |
||||
|
where id = #{item.id} |
||||
|
</foreach> |
||||
|
</update> |
||||
|
|
||||
|
<!-- 批量修改某几个字段 --> |
||||
|
<delete id="editSomeFields" parameterType="HashMap"> |
||||
|
update xm_cost_nlabor |
||||
|
<set> |
||||
|
<include refid="someFieldSet"/> |
||||
|
</set> |
||||
|
where (id) in |
||||
|
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
<!-- 批量删除 --> |
||||
|
<delete id="batchDelete" parameterType="List"> |
||||
|
delete from xm_cost_nlabor |
||||
|
where |
||||
|
(id) in |
||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item.id} ) |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
|
||||
|
<!--sql片段 列--> |
||||
|
<sql id="columns"> |
||||
|
project_id,userid,ctime,send_time,username,project_name,remark,id,task_id,task_name,subject_id,biz_sdate,biz_edate,act_at,cost_type,biz_month,biz_date,subject_name,ubranch_id,branch_id |
||||
|
</sql> |
||||
|
|
||||
|
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS--> |
||||
|
<sql id="where"> |
||||
|
<if test="projectId != null and projectId != ''"> and res.project_id = #{projectId} </if> |
||||
|
<if test="userid != null and userid != ''"> and res.userid = #{userid} </if> |
||||
|
<if test="ctime != null"> and date_format(res.ctime,'%Y-%m-%d') = date_format(#{ctime},'%Y-%m-%d') </if> |
||||
|
<if test="sendTime != null"> and date_format(res.send_time,'%Y-%m-%d') = date_format(#{sendTime},'%Y-%m-%d') </if> |
||||
|
<if test="username != null and username != ''"> and res.username = #{username} </if> |
||||
|
<if test="projectName != null and projectName != ''"> and res.project_name = #{projectName} </if> |
||||
|
<if test="remark != null and remark != ''"> and res.remark = #{remark} </if> |
||||
|
<if test="id != null and id != ''"> and res.id = #{id} </if> |
||||
|
<if test="taskId != null and taskId != ''"> and res.task_id = #{taskId} </if> |
||||
|
<if test="taskName != null and taskName != ''"> and res.task_name = #{taskName} </if> |
||||
|
<if test="subjectId != null and subjectId != ''"> and res.subject_id = #{subjectId} </if> |
||||
|
<if test="bizSdate != null"> and date_format(res.biz_sdate,'%Y-%m-%d') = date_format(#{bizSdate},'%Y-%m-%d') </if> |
||||
|
<if test="bizEdate != null"> and date_format(res.biz_edate,'%Y-%m-%d') = date_format(#{bizEdate},'%Y-%m-%d') </if> |
||||
|
<if test="actAt != null and actAt != ''"> and res.act_at = #{actAt} </if> |
||||
|
<if test="costType != null and costType != ''"> and res.cost_type = #{costType} </if> |
||||
|
<if test="bizMonth != null and bizMonth != ''"> and res.biz_month = #{bizMonth} </if> |
||||
|
<if test="bizDate != null and bizDate != ''"> and res.biz_date = #{bizDate} </if> |
||||
|
<if test="subjectName != null and subjectName != ''"> and res.subject_name = #{subjectName} </if> |
||||
|
<if test="ubranchId != null and ubranchId != ''"> and res.ubranch_id = #{ubranchId} </if> |
||||
|
<if test="branchId != null and branchId != ''"> and res.branch_id = #{branchId} </if> |
||||
|
</sql> |
||||
|
<!--sql片段 更新字段 --> |
||||
|
<sql id="set"> |
||||
|
project_id = #{projectId}, |
||||
|
userid = #{userid}, |
||||
|
ctime = #{ctime}, |
||||
|
send_time = #{sendTime}, |
||||
|
username = #{username}, |
||||
|
project_name = #{projectName}, |
||||
|
remark = #{remark}, |
||||
|
task_id = #{taskId}, |
||||
|
task_name = #{taskName}, |
||||
|
subject_id = #{subjectId}, |
||||
|
biz_sdate = #{bizSdate}, |
||||
|
biz_edate = #{bizEdate}, |
||||
|
act_at = #{actAt}, |
||||
|
cost_type = #{costType}, |
||||
|
biz_month = #{bizMonth}, |
||||
|
biz_date = #{bizDate}, |
||||
|
subject_name = #{subjectName}, |
||||
|
ubranch_id = #{ubranchId}, |
||||
|
branch_id = #{branchId} |
||||
|
</sql> |
||||
|
<sql id="someFieldSet"> |
||||
|
<if test="projectId != null and projectId != ''"> project_id = #{projectId}, </if> |
||||
|
<if test="userid != null and userid != ''"> userid = #{userid}, </if> |
||||
|
<if test="ctime != null"> ctime = #{ctime}, </if> |
||||
|
<if test="sendTime != null"> send_time = #{sendTime}, </if> |
||||
|
<if test="username != null and username != ''"> username = #{username}, </if> |
||||
|
<if test="projectName != null and projectName != ''"> project_name = #{projectName}, </if> |
||||
|
<if test="remark != null and remark != ''"> remark = #{remark}, </if> |
||||
|
<if test="taskId != null and taskId != ''"> task_id = #{taskId}, </if> |
||||
|
<if test="taskName != null and taskName != ''"> task_name = #{taskName}, </if> |
||||
|
<if test="subjectId != null and subjectId != ''"> subject_id = #{subjectId}, </if> |
||||
|
<if test="bizSdate != null"> biz_sdate = #{bizSdate}, </if> |
||||
|
<if test="bizEdate != null"> biz_edate = #{bizEdate}, </if> |
||||
|
<if test="actAt != null and actAt != ''"> act_at = #{actAt}, </if> |
||||
|
<if test="costType != null and costType != ''"> cost_type = #{costType}, </if> |
||||
|
<if test="bizMonth != null and bizMonth != ''"> biz_month = #{bizMonth}, </if> |
||||
|
<if test="bizDate != null and bizDate != ''"> biz_date = #{bizDate}, </if> |
||||
|
<if test="subjectName != null and subjectName != ''"> subject_name = #{subjectName}, </if> |
||||
|
<if test="ubranchId != null and ubranchId != ''"> ubranch_id = #{ubranchId}, </if> |
||||
|
<if test="branchId != null and branchId != ''"> branch_id = #{branchId}, </if> |
||||
|
</sql> |
||||
|
<!--sql片段 批量更新 --> |
||||
|
<sql id="batchSet"> |
||||
|
project_id = #{item.projectId}, |
||||
|
userid = #{item.userid}, |
||||
|
ctime = #{item.ctime}, |
||||
|
send_time = #{item.sendTime}, |
||||
|
username = #{item.username}, |
||||
|
project_name = #{item.projectName}, |
||||
|
remark = #{item.remark}, |
||||
|
task_id = #{item.taskId}, |
||||
|
task_name = #{item.taskName}, |
||||
|
subject_id = #{item.subjectId}, |
||||
|
biz_sdate = #{item.bizSdate}, |
||||
|
biz_edate = #{item.bizEdate}, |
||||
|
act_at = #{item.actAt}, |
||||
|
cost_type = #{item.costType}, |
||||
|
biz_month = #{item.bizMonth}, |
||||
|
biz_date = #{item.bizDate}, |
||||
|
subject_name = #{item.subjectName}, |
||||
|
ubranch_id = #{item.ubranchId}, |
||||
|
branch_id = #{item.branchId} |
||||
|
</sql> |
||||
|
</mapper> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue