Browse Source

重新生成工时表

master
陈裕财 4 years ago
parent
commit
67eef1d2e1
  1. 295
      xm-core/src/main/java/com/xm/core/ctrl/XmTaskSbillDetailController.java
  2. 19
      xm-core/src/main/java/com/xm/core/entity/XmTaskSbill.java
  3. 65
      xm-core/src/main/java/com/xm/core/entity/XmTaskWorkload.java
  4. 24
      xm-core/src/main/java/com/xm/core/service/XmTaskSbillDetailService.java
  5. 264
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTaskSbillDetailMapper.xml
  6. 12
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTaskSbillMapper.xml
  7. 49
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTaskWorkloadMapper.xml

295
xm-core/src/main/java/com/xm/core/ctrl/XmTaskSbillDetailController.java

@ -0,0 +1,295 @@
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.xm.core.service.XmTaskSbillDetailService;
import com.xm.core.entity.XmTaskSbillDetail;
/**
* url编制采用rest风格,如对xm_task_sbill_detail 工时登记表的操作有增删改查,对应的url分别为:<br>
* 新增: core/xmTaskSbillDetail/add <br>
* 查询: core/xmTaskSbillDetail/list<br>
* 模糊查询: core/xmTaskSbillDetail/listKey<br>
* 修改: core/xmTaskSbillDetail/edit <br>
* 删除: core/xmTaskSbillDetail/del<br>
* 批量删除: core/xmTaskSbillDetail/batchDel<br>
* 组织 com 顶级模块 xm 大模块 core 小模块 <br>
* 实体 XmTaskSbillDetail xm_task_sbill_detail 当前主键(包括多主键): id;
***/
@RestController("xm.core.xmTaskSbillDetailController")
@RequestMapping(value="/**/core/xmTaskSbillDetail")
@Api(tags={"工时登记表操作接口"})
public class XmTaskSbillDetailController {
static Logger logger =LoggerFactory.getLogger(XmTaskSbillDetailController.class);
@Autowired
private XmTaskSbillDetailService xmTaskSbillDetailService;
Map<String,Object> fieldsMap = toMap(new XmTaskSbillDetail());
@ApiOperation( value = "查询工时登记表信息列表",notes=" ")
@ApiResponses({
@ApiResponse(code = 200,response=XmTaskSbillDetail.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}")
})
@RequestMapping(value="/list",method=RequestMethod.GET)
public Map<String,Object> listXmTaskSbillDetail( @RequestParam Map<String,Object> xmTaskSbillDetail){
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("查询成功");
RequestUtils.transformArray(xmTaskSbillDetail, "ids");
PageUtils.startPage(xmTaskSbillDetail);
List<Map<String,Object>> xmTaskSbillDetailList = xmTaskSbillDetailService.selectListMapByWhere(xmTaskSbillDetail); //列出XmTaskSbillDetail列表
PageUtils.responePage(m, xmTaskSbillDetailList);
m.put("data",xmTaskSbillDetailList);
m.put("tips", tips);
return m;
}
/**
@ApiOperation( value = "新增一条工时登记表信息",notes=" ")
@ApiResponses({
@ApiResponse(code = 200,response=XmTaskSbillDetail.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}")
})
@RequestMapping(value="/add",method=RequestMethod.POST)
public Map<String,Object> addXmTaskSbillDetail(@RequestBody XmTaskSbillDetail xmTaskSbillDetail) {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功新增一条数据");
try{
boolean createPk=false;
if(!StringUtils.hasText(xmTaskSbillDetail.getId())) {
createPk=true;
xmTaskSbillDetail.setId(xmTaskSbillDetailService.createKey("id"));
}
if(createPk==false){
if(xmTaskSbillDetailService.selectOneObject(xmTaskSbillDetail) !=null ){
return failed("pk-exists","编号重复,请修改编号再提交");
}
}
xmTaskSbillDetailService.insert(xmTaskSbillDetail);
m.put("data",xmTaskSbillDetail);
}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> delXmTaskSbillDetail(@RequestBody XmTaskSbillDetail xmTaskSbillDetail){
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功删除一条数据");
try{
if(!StringUtils.hasText(xmTaskSbillDetail.getId())) {
return failed("pk-not-exists","请上送主键参数id");
}
XmTaskSbillDetail xmTaskSbillDetailDb = xmTaskSbillDetailService.selectOneObject(xmTaskSbillDetail);
if( xmTaskSbillDetailDb == null ){
return failed("data-not-exists","数据不存在,无法删除");
}
xmTaskSbillDetailService.deleteByPk(xmTaskSbillDetail);
}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=XmTaskSbillDetail.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}")
})
@RequestMapping(value="/edit",method=RequestMethod.POST)
public Map<String,Object> editXmTaskSbillDetail(@RequestBody XmTaskSbillDetail xmTaskSbillDetail) {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功更新一条数据");
try{
if(!StringUtils.hasText(xmTaskSbillDetail.getId())) {
return failed("pk-not-exists","请上送主键参数id");
}
XmTaskSbillDetail xmTaskSbillDetailDb = xmTaskSbillDetailService.selectOneObject(xmTaskSbillDetail);
if( xmTaskSbillDetailDb == null ){
return failed("data-not-exists","数据不存在,无法修改");
}
xmTaskSbillDetailService.updateSomeFieldByPk(xmTaskSbillDetail);
m.put("data",xmTaskSbillDetail);
}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=XmTaskSbillDetail.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}")
})
@RequestMapping(value="/editSomeFields",method=RequestMethod.POST)
public Map<String,Object> editSomeFields(@RequestBody Map<String,Object> xmTaskSbillDetailMap) {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功更新一条数据");
try{
List<String> ids= (List<String>) xmTaskSbillDetailMap.get("ids");
if(ids==null || ids.size()==0){
return failed("ids-0","ids不能为空");
}
Set<String> fields=new HashSet<>();
fields.add("id");
for (String fieldName : xmTaskSbillDetailMap.keySet()) {
if(fields.contains(fieldName)){
return failed(fieldName+"-no-edit",fieldName+"不允许修改");
}
}
Set<String> fieldKey=xmTaskSbillDetailMap.keySet().stream().filter(i-> fieldsMap.containsKey(i)).collect(Collectors.toSet());
fieldKey=fieldKey.stream().filter(i->!StringUtils.isEmpty(xmTaskSbillDetailMap.get(i) )).collect(Collectors.toSet());
if(fieldKey.size()<=0) {
return failed("fieldKey-0","没有需要更新的字段");
}
XmTaskSbillDetail xmTaskSbillDetail = fromMap(xmTaskSbillDetailMap,XmTaskSbillDetail.class);
List<XmTaskSbillDetail> xmTaskSbillDetailsDb=xmTaskSbillDetailService.selectListByIds(ids);
if(xmTaskSbillDetailsDb==null ||xmTaskSbillDetailsDb.size()==0){
return failed("data-0","记录已不存在");
}
List<XmTaskSbillDetail> can=new ArrayList<>();
List<XmTaskSbillDetail> no=new ArrayList<>();
User user = LoginUtils.getCurrentUserInfo();
for (XmTaskSbillDetail xmTaskSbillDetailDb : xmTaskSbillDetailsDb) {
Tips tips2 = new Tips("检查通过");
if(!tips2.isOk()){
no.add(xmTaskSbillDetailDb);
}else{
can.add(xmTaskSbillDetailDb);
}
}
if(can.size()>0){
xmTaskSbillDetailMap.put("ids",can.stream().map(i->i.getId()).collect(Collectors.toList()));
xmTaskSbillDetailService.editSomeFields(xmTaskSbillDetailMap);
}
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> batchDelXmTaskSbillDetail(@RequestBody List<XmTaskSbillDetail> xmTaskSbillDetails) {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功删除");
try{
if(xmTaskSbillDetails.size()<=0){
return failed("data-0","请上送待删除数据列表");
}
List<XmTaskSbillDetail> datasDb=xmTaskSbillDetailService.selectListByIds(xmTaskSbillDetails.stream().map(i-> i.getId() ).collect(Collectors.toList()));
List<XmTaskSbillDetail> can=new ArrayList<>();
List<XmTaskSbillDetail> no=new ArrayList<>();
for (XmTaskSbillDetail data : datasDb) {
if(true){
can.add(data);
}else{
no.add(data);
}
}
List<String> msgs=new ArrayList<>();
if(can.size()>0){
xmTaskSbillDetailService.batchDelete(xmTaskSbillDetails);
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;
}
*/
}

19
xm-core/src/main/java/com/xm/core/entity/XmTaskSbill.java

@ -8,9 +8,9 @@ import java.util.Date;
/**
* 组织 com 顶级模块 xm 大模块 core 小模块 <br>
* 实体 XmTaskSbill所有属性名: <br>
* id,title,amt,ctime,cuserid,cusername,remark,branchId,deptid,cpId,cpName,workload,bizMonth,bizDate,bizFlowState,bizProcInstId,ltime,status,fmsg,projectId,projectName;<br>
* id,title,amt,ctime,cuserid,cusername,remark,branchId,deptid,cpId,cpName,workload,bizMonth,bizDate,bizFlowState,bizProcInstId,ltime,status,fmsg,projectId,projectName,userCnt;<br>
* xm_task_sbill 任务结算表的所有字段名: <br>
* id,title,amt,ctime,cuserid,cusername,remark,branch_id,deptid,cp_id,cp_name,workload,biz_month,biz_date,biz_flow_state,biz_proc_inst_id,ltime,status,fmsg,project_id,project_name;<br>
* id,title,amt,ctime,cuserid,cusername,remark,branch_id,deptid,cp_id,cp_name,workload,biz_month,biz_date,biz_flow_state,biz_proc_inst_id,ltime,status,fmsg,project_id,project_name,user_cnt;<br>
* 当前主键(包括多主键):<br>
* id;<br>
*/
@ -82,6 +82,9 @@ public class XmTaskSbill implements java.io.Serializable {
@ApiModelProperty(notes="项目名称",allowEmptyValue=true,example="",allowableValues="")
String projectName;
@ApiModelProperty(notes="结算人数",allowEmptyValue=true,example="",allowableValues="")
Integer userCnt;
/**结算单据编号**/
public XmTaskSbill(String id) {
@ -218,6 +221,12 @@ public class XmTaskSbill implements java.io.Serializable {
public void setProjectName(String projectName) {
this.projectName = projectName;
}
/**
* 结算人数
**/
public void setUserCnt(Integer userCnt) {
this.userCnt = userCnt;
}
/**
* 结算单据编号
@ -345,5 +354,11 @@ public class XmTaskSbill implements java.io.Serializable {
public String getProjectName() {
return this.projectName;
}
/**
* 结算人数
**/
public Integer getUserCnt() {
return this.userCnt;
}
}

65
xm-core/src/main/java/com/xm/core/entity/XmTaskWorkload.java

@ -8,9 +8,9 @@ import java.math.BigDecimal;
/**
* 组织 com 顶级模块 xm 大模块 core 小模块 <br>
* 实体 XmTaskWorkload所有属性名: <br>
* userid,username,ctime,taskId,cuserid,bizDate,wstatus,remark,ttype,id,sbillId,stime,sstatus,amt,samt,workload,rworkload,cusername,projectId,sworkload;<br>
* userid,username,ctime,taskId,cuserid,bizDate,wstatus,remark,ttype,id,stime,sstatus,workload,rworkload,cusername,projectId,detailId;<br>
* xm_task_workload 工时登记表的所有字段名: <br>
* userid,username,ctime,task_id,cuserid,biz_date,wstatus,remark,ttype,id,sbill_id,stime,sstatus,amt,samt,workload,rworkload,cusername,project_id,sworkload;<br>
* userid,username,ctime,task_id,cuserid,biz_date,wstatus,remark,ttype,id,stime,sstatus,workload,rworkload,cusername,project_id,detail_id;<br>
* 当前主键(包括多主键):<br>
* id;<br>
*/
@ -50,21 +50,12 @@ public class XmTaskWorkload implements java.io.Serializable {
@ApiModelProperty(notes="任务类型-关联字典taskType",allowEmptyValue=true,example="",allowableValues="")
String ttype;
@ApiModelProperty(notes="结算单据编号",allowEmptyValue=true,example="",allowableValues="")
String sbillId;
@ApiModelProperty(notes="结算提交时间",allowEmptyValue=true,example="",allowableValues="")
Date stime;
@ApiModelProperty(notes="结算状态0-无需结算,1-待结算2-已提交3-已通过4-已结算",allowEmptyValue=true,example="",allowableValues="")
String sstatus;
@ApiModelProperty(notes="工时对应金额",allowEmptyValue=true,example="",allowableValues="")
BigDecimal amt;
@ApiModelProperty(notes="结算工时对应结算金额",allowEmptyValue=true,example="",allowableValues="")
BigDecimal samt;
@ApiModelProperty(notes="工时,一个task_id可多次提交,小时",allowEmptyValue=true,example="",allowableValues="")
BigDecimal workload;
@ -77,8 +68,8 @@ public class XmTaskWorkload implements java.io.Serializable {
@ApiModelProperty(notes="归属项目",allowEmptyValue=true,example="",allowableValues="")
String projectId;
@ApiModelProperty(notes="结算工时,用于结算,默认=workload",allowEmptyValue=true,example="",allowableValues="")
BigDecimal sworkload;
@ApiModelProperty(notes="结算明细编号,指向xm_task_sbill_detail.id",allowEmptyValue=true,example="",allowableValues="")
String detailId;
/**主键**/
public XmTaskWorkload(String id) {
@ -149,12 +140,6 @@ public class XmTaskWorkload implements java.io.Serializable {
public void setId(String id) {
this.id = id;
}
/**
* 结算单据编号
**/
public void setSbillId(String sbillId) {
this.sbillId = sbillId;
}
/**
* 结算提交时间
**/
@ -167,18 +152,6 @@ public class XmTaskWorkload implements java.io.Serializable {
public void setSstatus(String sstatus) {
this.sstatus = sstatus;
}
/**
* 工时对应金额
**/
public void setAmt(BigDecimal amt) {
this.amt = amt;
}
/**
* 结算工时对应结算金额
**/
public void setSamt(BigDecimal samt) {
this.samt = samt;
}
/**
* 工时一个task_id可多次提交小时
**/
@ -204,10 +177,10 @@ public class XmTaskWorkload implements java.io.Serializable {
this.projectId = projectId;
}
/**
* 结算工时用于结算默认=workload
* 结算明细编号指向xm_task_sbill_detail.id
**/
public void setSworkload(BigDecimal sworkload) {
this.sworkload = sworkload;
public void setDetailId(String detailId) {
this.detailId = detailId;
}
/**
@ -270,12 +243,6 @@ public class XmTaskWorkload implements java.io.Serializable {
public String getId() {
return this.id;
}
/**
* 结算单据编号
**/
public String getSbillId() {
return this.sbillId;
}
/**
* 结算提交时间
**/
@ -288,18 +255,6 @@ public class XmTaskWorkload implements java.io.Serializable {
public String getSstatus() {
return this.sstatus;
}
/**
* 工时对应金额
**/
public BigDecimal getAmt() {
return this.amt;
}
/**
* 结算工时对应结算金额
**/
public BigDecimal getSamt() {
return this.samt;
}
/**
* 工时一个task_id可多次提交小时
**/
@ -325,10 +280,10 @@ public class XmTaskWorkload implements java.io.Serializable {
return this.projectId;
}
/**
* 结算工时用于结算默认=workload
* 结算明细编号指向xm_task_sbill_detail.id
**/
public BigDecimal getSworkload() {
return this.sworkload;
public String getDetailId() {
return this.detailId;
}
}

24
xm-core/src/main/java/com/xm/core/service/XmTaskSbillDetailService.java

@ -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.XmTaskSbillDetail;
/**
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br>
* 组织 com 顶级模块 xm 大模块 core 小模块 <br>
* 实体 XmTaskSbillDetail xm_task_sbill_detail 当前主键(包括多主键): id;
***/
@Service("xm.core.xmTaskSbillDetailService")
public class XmTaskSbillDetailService extends BaseService {
static Logger logger =LoggerFactory.getLogger(XmTaskSbillDetailService.class);
}

264
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTaskSbillDetailMapper.xml

@ -0,0 +1,264 @@
<?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.XmTaskSbillDetail">
<!--开始 自定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_task_sbill_detail res
<where>
<include refid="whereForMap"/>
<include refid="where"/>
</where>
</select>
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> -->
<select id="selectListByWhere" parameterType="com.xm.core.entity.XmTaskSbillDetail" resultType="com.xm.core.entity.XmTaskSbillDetail">
select * from xm_task_sbill_detail res
<where>
<include refid="where"/>
</where>
</select>
<!-- 通过主键查询获取数据对象 返回object -->
<select id="selectOneObject" parameterType="com.xm.core.entity.XmTaskSbillDetail" resultType="com.xm.core.entity.XmTaskSbillDetail">
select * from xm_task_sbill_detail res
where
res.id = #{id}
</select>
<select id="selectListByIds" parameterType="List" resultType="com.xm.core.entity.XmTaskSbillDetail">
select * from xm_task_sbill_detail 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_task_sbill_detail res
where
res.id = #{id}
</select>
<!-- 获取数据条目 返回long -->
<select id="countByWhere" parameterType="com.xm.core.entity.XmTaskSbillDetail" resultType="long">
select count(*) from xm_task_sbill_detail res
<where>
<include refid="where"/>
</where>
</select>
<!-- 新增一条记录 主键id,-->
<insert id="insert" parameterType="com.xm.core.entity.XmTaskSbillDetail" useGeneratedKeys="false" keyProperty="id">
insert into xm_task_sbill_detail(
<include refid="columns"/>
) values (
#{userid},#{username},#{ctime},#{taskId},#{bizDate},#{remark},#{id},#{sbillId},#{stime},#{sstatus},#{amt},#{samt},#{workload},#{projectId},#{sworkload},#{bizMonth},#{budgetAt},#{budgetWorkload},#{initWorkload},#{quoteAt},#{quoteWorkload},#{sschemel},#{uniPrice},#{qendTime},#{qstartTime},#{actEndTime},#{actStartTime}
)
</insert>
<!-- 按条件删除若干条记录-->
<delete id="deleteByWhere" parameterType="com.xm.core.entity.XmTaskSbillDetail">
delete from xm_task_sbill_detail res
<where>
<include refid="where"/>
</where>
</delete>
<!-- 按主键删除一条记录-->
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmTaskSbillDetail">
delete from xm_task_sbill_detail
where id = #{id}
</delete>
<!-- 根据条件修改若干条记录 -->
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmTaskSbillDetail">
update xm_task_sbill_detail
<set>
<include refid="someFieldSet"/>
</set>
where id = #{id}
</update>
<!-- 根据主键修改一条记录 -->
<update id="updateByPk" parameterType="com.xm.core.entity.XmTaskSbillDetail">
update xm_task_sbill_detail
<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_task_sbill_detail
set
<include refid="batchSet"/>
where id = #{item.id}
</foreach>
</update>
<!-- 批量修改某几个字段 -->
<delete id="editSomeFields" parameterType="HashMap">
update xm_task_sbill_detail
<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_task_sbill_detail
where
(id) in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" >
( #{item.id} )
</foreach>
</delete>
<!--sql片段 列-->
<sql id="columns">
userid,username,ctime,task_id,biz_date,remark,id,sbill_id,stime,sstatus,amt,samt,workload,project_id,sworkload,biz_month,budget_at,budget_workload,init_workload,quote_at,quote_workload,sschemel,uni_price,qend_time,qstart_time,act_end_time,act_start_time
</sql>
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS-->
<sql id="where">
<if test="userid != null and userid != ''"> and res.userid = #{userid} </if>
<if test="username != null and username != ''"> and res.username = #{username} </if>
<if test="ctime != null"> and date_format(res.ctime,'%Y-%m-%d') = date_format(#{ctime},'%Y-%m-%d') </if>
<if test="taskId != null and taskId != ''"> and res.task_id = #{taskId} </if>
<if test="bizDate != null and bizDate != ''"> and res.biz_date = #{bizDate} </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="sbillId != null and sbillId != ''"> and res.sbill_id = #{sbillId} </if>
<if test="stime != null"> and date_format(res.stime,'%Y-%m-%d') = date_format(#{stime},'%Y-%m-%d') </if>
<if test="sstatus != null and sstatus != ''"> and res.sstatus = #{sstatus} </if>
<if test="amt != null and amt != ''"> and res.amt = #{amt} </if>
<if test="samt != null and samt != ''"> and res.samt = #{samt} </if>
<if test="workload != null and workload != ''"> and res.workload = #{workload} </if>
<if test="projectId != null and projectId != ''"> and res.project_id = #{projectId} </if>
<if test="sworkload != null and sworkload != ''"> and res.sworkload = #{sworkload} </if>
<if test="bizMonth != null and bizMonth != ''"> and res.biz_month = #{bizMonth} </if>
<if test="budgetAt != null and budgetAt != ''"> and res.budget_at = #{budgetAt} </if>
<if test="budgetWorkload != null and budgetWorkload != ''"> and res.budget_workload = #{budgetWorkload} </if>
<if test="initWorkload != null and initWorkload != ''"> and res.init_workload = #{initWorkload} </if>
<if test="quoteAt != null and quoteAt != ''"> and res.quote_at = #{quoteAt} </if>
<if test="quoteWorkload != null and quoteWorkload != ''"> and res.quote_workload = #{quoteWorkload} </if>
<if test="sschemel != null and sschemel != ''"> and res.sschemel = #{sschemel} </if>
<if test="uniPrice != null and uniPrice != ''"> and res.uni_price = #{uniPrice} </if>
<if test="qendTime != null"> and date_format(res.qend_time,'%Y-%m-%d') = date_format(#{qendTime},'%Y-%m-%d') </if>
<if test="qstartTime != null"> and date_format(res.qstart_time,'%Y-%m-%d') = date_format(#{qstartTime},'%Y-%m-%d') </if>
<if test="actEndTime != null"> and date_format(res.act_end_time,'%Y-%m-%d') = date_format(#{actEndTime},'%Y-%m-%d') </if>
<if test="actStartTime != null"> and date_format(res.act_start_time,'%Y-%m-%d') = date_format(#{actStartTime},'%Y-%m-%d') </if>
</sql>
<!--sql片段 更新字段 -->
<sql id="set">
userid = #{userid},
username = #{username},
ctime = #{ctime},
task_id = #{taskId},
biz_date = #{bizDate},
remark = #{remark},
sbill_id = #{sbillId},
stime = #{stime},
sstatus = #{sstatus},
amt = #{amt},
samt = #{samt},
workload = #{workload},
project_id = #{projectId},
sworkload = #{sworkload},
biz_month = #{bizMonth},
budget_at = #{budgetAt},
budget_workload = #{budgetWorkload},
init_workload = #{initWorkload},
quote_at = #{quoteAt},
quote_workload = #{quoteWorkload},
sschemel = #{sschemel},
uni_price = #{uniPrice},
qend_time = #{qendTime},
qstart_time = #{qstartTime},
act_end_time = #{actEndTime},
act_start_time = #{actStartTime}
</sql>
<sql id="someFieldSet">
<if test="userid != null and userid != ''"> userid = #{userid}, </if>
<if test="username != null and username != ''"> username = #{username}, </if>
<if test="ctime != null"> ctime = #{ctime}, </if>
<if test="taskId != null and taskId != ''"> task_id = #{taskId}, </if>
<if test="bizDate != null and bizDate != ''"> biz_date = #{bizDate}, </if>
<if test="remark != null and remark != ''"> remark = #{remark}, </if>
<if test="sbillId != null and sbillId != ''"> sbill_id = #{sbillId}, </if>
<if test="stime != null"> stime = #{stime}, </if>
<if test="sstatus != null and sstatus != ''"> sstatus = #{sstatus}, </if>
<if test="amt != null and amt != ''"> amt = #{amt}, </if>
<if test="samt != null and samt != ''"> samt = #{samt}, </if>
<if test="workload != null and workload != ''"> workload = #{workload}, </if>
<if test="projectId != null and projectId != ''"> project_id = #{projectId}, </if>
<if test="sworkload != null and sworkload != ''"> sworkload = #{sworkload}, </if>
<if test="bizMonth != null and bizMonth != ''"> biz_month = #{bizMonth}, </if>
<if test="budgetAt != null and budgetAt != ''"> budget_at = #{budgetAt}, </if>
<if test="budgetWorkload != null and budgetWorkload != ''"> budget_workload = #{budgetWorkload}, </if>
<if test="initWorkload != null and initWorkload != ''"> init_workload = #{initWorkload}, </if>
<if test="quoteAt != null and quoteAt != ''"> quote_at = #{quoteAt}, </if>
<if test="quoteWorkload != null and quoteWorkload != ''"> quote_workload = #{quoteWorkload}, </if>
<if test="sschemel != null and sschemel != ''"> sschemel = #{sschemel}, </if>
<if test="uniPrice != null and uniPrice != ''"> uni_price = #{uniPrice}, </if>
<if test="qendTime != null"> qend_time = #{qendTime}, </if>
<if test="qstartTime != null"> qstart_time = #{qstartTime}, </if>
<if test="actEndTime != null"> act_end_time = #{actEndTime}, </if>
<if test="actStartTime != null"> act_start_time = #{actStartTime}, </if>
</sql>
<!--sql片段 批量更新 -->
<sql id="batchSet">
userid = #{item.userid},
username = #{item.username},
ctime = #{item.ctime},
task_id = #{item.taskId},
biz_date = #{item.bizDate},
remark = #{item.remark},
sbill_id = #{item.sbillId},
stime = #{item.stime},
sstatus = #{item.sstatus},
amt = #{item.amt},
samt = #{item.samt},
workload = #{item.workload},
project_id = #{item.projectId},
sworkload = #{item.sworkload},
biz_month = #{item.bizMonth},
budget_at = #{item.budgetAt},
budget_workload = #{item.budgetWorkload},
init_workload = #{item.initWorkload},
quote_at = #{item.quoteAt},
quote_workload = #{item.quoteWorkload},
sschemel = #{item.sschemel},
uni_price = #{item.uniPrice},
qend_time = #{item.qendTime},
qstart_time = #{item.qstartTime},
act_end_time = #{item.actEndTime},
act_start_time = #{item.actStartTime}
</sql>
</mapper>

12
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTaskSbillMapper.xml

@ -90,7 +90,7 @@
insert into xm_task_sbill(
<include refid="columns"/>
) values (
#{id},#{title},#{amt},#{ctime},#{cuserid},#{cusername},#{remark},#{branchId},#{deptid},#{cpId},#{cpName},#{workload},#{bizMonth},#{bizDate},#{bizFlowState},#{bizProcInstId},#{ltime},#{status},#{fmsg},#{projectId},#{projectName}
#{id},#{title},#{amt},#{ctime},#{cuserid},#{cusername},#{remark},#{branchId},#{deptid},#{cpId},#{cpName},#{workload},#{bizMonth},#{bizDate},#{bizFlowState},#{bizProcInstId},#{ltime},#{status},#{fmsg},#{projectId},#{projectName},#{userCnt}
)
</insert>
@ -165,7 +165,7 @@
<!--sql片段 列-->
<sql id="columns">
id,title,amt,ctime,cuserid,cusername,remark,branch_id,deptid,cp_id,cp_name,workload,biz_month,biz_date,biz_flow_state,biz_proc_inst_id,ltime,status,fmsg,project_id,project_name
id,title,amt,ctime,cuserid,cusername,remark,branch_id,deptid,cp_id,cp_name,workload,biz_month,biz_date,biz_flow_state,biz_proc_inst_id,ltime,status,fmsg,project_id,project_name,user_cnt
</sql>
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS-->
@ -191,6 +191,7 @@
<if test="fmsg != null and fmsg != ''"> and res.fmsg = #{fmsg} </if>
<if test="projectId != null and projectId != ''"> and res.project_id = #{projectId} </if>
<if test="projectName != null and projectName != ''"> and res.project_name = #{projectName} </if>
<if test="userCnt != null and userCnt != ''"> and res.user_cnt = #{userCnt} </if>
</sql>
<!--sql片段 更新字段 -->
<sql id="set">
@ -213,7 +214,8 @@
status = #{status},
fmsg = #{fmsg},
project_id = #{projectId},
project_name = #{projectName}
project_name = #{projectName},
user_cnt = #{userCnt}
</sql>
<sql id="someFieldSet">
<if test="title != null and title != ''"> title = #{title}, </if>
@ -236,6 +238,7 @@
<if test="fmsg != null and fmsg != ''"> fmsg = #{fmsg}, </if>
<if test="projectId != null and projectId != ''"> project_id = #{projectId}, </if>
<if test="projectName != null and projectName != ''"> project_name = #{projectName}, </if>
<if test="userCnt != null and userCnt != ''"> user_cnt = #{userCnt}, </if>
</sql>
<!--sql片段 批量更新 -->
<sql id="batchSet">
@ -258,6 +261,7 @@
status = #{item.status},
fmsg = #{item.fmsg},
project_id = #{item.projectId},
project_name = #{item.projectName}
project_name = #{item.projectName},
user_cnt = #{item.userCnt}
</sql>
</mapper>

49
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTaskWorkloadMapper.xml

@ -64,17 +64,6 @@
</where>
</update>
<update id="editSomeFields" parameterType="HashMap">
update xm_task_workload res
<set>
<include refid="someFieldSet"/>
</set>
where id in
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
</update>
<select id="listProjectWorkloadSetDay" parameterType="HashMap" resultType="HashMap">
select
res.biz_date,
@ -167,7 +156,7 @@
</select>
<!-- 获取数据条目 返回long -->
<select id="countByWhere" parameterType="com.xm.core.entity.XmTaskWorkload" resultType="long">
select count(1) from xm_task_workload res
select count(*) from xm_task_workload res
<where>
<include refid="where"/>
</where>
@ -177,7 +166,7 @@
insert into xm_task_workload(
<include refid="columns"/>
) values (
#{userid},#{username},#{ctime},#{taskId},#{cuserid},#{bizDate},#{wstatus},#{remark},#{ttype},#{id},#{sbillId},#{stime},#{sstatus},#{amt},#{samt},#{workload},#{rworkload},#{cusername},#{projectId},#{sworkload}
#{userid},#{username},#{ctime},#{taskId},#{cuserid},#{bizDate},#{wstatus},#{remark},#{ttype},#{id},#{stime},#{sstatus},#{workload},#{rworkload},#{cusername},#{projectId},#{detailId}
)
</insert>
@ -227,6 +216,18 @@
where id = #{item.id}
</foreach>
</update>
<!-- 批量修改某几个字段 -->
<delete id="editSomeFields" parameterType="HashMap">
update xm_task_workload
<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_task_workload
@ -240,7 +241,7 @@
<!--sql片段 列-->
<sql id="columns">
userid,username,ctime,task_id,cuserid,biz_date,wstatus,remark,ttype,id,sbill_id,stime,sstatus,amt,samt,workload,rworkload,cusername,project_id,sworkload
userid,username,ctime,task_id,cuserid,biz_date,wstatus,remark,ttype,id,stime,sstatus,workload,rworkload,cusername,project_id,detail_id
</sql>
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS-->
@ -255,16 +256,13 @@
<if test="remark != null and remark != ''"> and res.remark = #{remark} </if>
<if test="ttype != null and ttype != ''"> and res.ttype = #{ttype} </if>
<if test="id != null and id != ''"> and res.id = #{id} </if>
<if test="sbillId != null and sbillId != ''"> and res.sbill_id = #{sbillId} </if>
<if test="stime != null"> and date_format(res.stime,'%Y-%m-%d') = date_format(#{stime},'%Y-%m-%d') </if>
<if test="sstatus != null and sstatus != ''"> and res.sstatus = #{sstatus} </if>
<if test="amt != null and amt != ''"> and res.amt = #{amt} </if>
<if test="samt != null and samt != ''"> and res.samt = #{samt} </if>
<if test="workload != null and workload != ''"> and res.workload = #{workload} </if>
<if test="rworkload != null and rworkload != ''"> and res.rworkload = #{rworkload} </if>
<if test="cusername != null and cusername != ''"> and res.cusername = #{cusername} </if>
<if test="projectId != null and projectId != ''"> and res.project_id = #{projectId} </if>
<if test="sworkload != null and sworkload != ''"> and res.sworkload = #{sworkload} </if>
<if test="detailId != null and detailId != ''"> and res.detail_id = #{detailId} </if>
</sql>
<!--sql片段 更新字段 -->
<sql id="set">
@ -277,16 +275,13 @@
wstatus = #{wstatus},
remark = #{remark},
ttype = #{ttype},
sbill_id = #{sbillId},
stime = #{stime},
sstatus = #{sstatus},
amt = #{amt},
samt = #{samt},
workload = #{workload},
rworkload = #{rworkload},
cusername = #{cusername},
project_id = #{projectId},
sworkload = #{sworkload}
detail_id = #{detailId}
</sql>
<sql id="someFieldSet">
<if test="userid != null and userid != ''"> userid = #{userid}, </if>
@ -298,16 +293,13 @@
<if test="wstatus != null and wstatus != ''"> wstatus = #{wstatus}, </if>
<if test="remark != null and remark != ''"> remark = #{remark}, </if>
<if test="ttype != null and ttype != ''"> ttype = #{ttype}, </if>
<if test="sbillId != null and sbillId != ''"> sbill_id = #{sbillId}, </if>
<if test="stime != null"> stime = #{stime}, </if>
<if test="sstatus != null and sstatus != ''"> sstatus = #{sstatus}, </if>
<if test="amt != null and amt != ''"> amt = #{amt}, </if>
<if test="samt != null and samt != ''"> samt = #{samt}, </if>
<if test="workload != null and workload != ''"> workload = #{workload}, </if>
<if test="rworkload != null and rworkload != ''"> rworkload = #{rworkload}, </if>
<if test="cusername != null and cusername != ''"> cusername = #{cusername}, </if>
<if test="projectId != null and projectId != ''"> project_id = #{projectId}, </if>
<if test="sworkload != null and sworkload != ''"> sworkload = #{sworkload}, </if>
<if test="detailId != null and detailId != ''"> detail_id = #{detailId}, </if>
</sql>
<!--sql片段 批量更新 -->
<sql id="batchSet">
@ -320,15 +312,12 @@
wstatus = #{item.wstatus},
remark = #{item.remark},
ttype = #{item.ttype},
sbill_id = #{item.sbillId},
stime = #{item.stime},
sstatus = #{item.sstatus},
amt = #{item.amt},
samt = #{item.samt},
workload = #{item.workload},
rworkload = #{item.rworkload},
cusername = #{item.cusername},
project_id = #{item.projectId},
sworkload = #{item.sworkload}
detail_id = #{item.detailId}
</sql>
</mapper>
Loading…
Cancel
Save