8 changed files with 0 additions and 604 deletions
-
8xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java
-
278xm-core/src/main/java/com/xm/core/ctrl/XmIterationLinkController.java
-
57xm-core/src/main/java/com/xm/core/entity/XmIterationLink.java
-
2xm-core/src/main/java/com/xm/core/service/XmGroupService.java
-
36xm-core/src/main/java/com/xm/core/service/XmIterationLinkService.java
-
8xm-core/src/main/java/com/xm/core/service/XmIterationService.java
-
14xm-core/src/main/java/com/xm/core/vo/XmIterationVo.java
-
201xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationLinkMapper.xml
@ -1,278 +0,0 @@ |
|||
package com.xm.core.ctrl; |
|||
|
|||
import com.mdp.core.entity.Tips; |
|||
import com.mdp.core.err.BizException; |
|||
import com.mdp.core.utils.RequestUtils; |
|||
import com.mdp.core.utils.ResponseHelper; |
|||
import com.mdp.mybatis.PageUtils; |
|||
import com.mdp.safe.client.entity.User; |
|||
import com.mdp.safe.client.utils.LoginUtils; |
|||
import com.mdp.swagger.ApiEntityParams; |
|||
import com.xm.core.entity.XmIterationLink; |
|||
import com.xm.core.entity.XmMenu; |
|||
import com.xm.core.entity.XmTask; |
|||
import com.xm.core.service.*; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiResponse; |
|||
import io.swagger.annotations.ApiResponses; |
|||
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.*; |
|||
import springfox.documentation.annotations.ApiIgnore; |
|||
|
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* url编制采用rest风格,如对XM.xm_iteration_product_link 迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表的操作有增删改查,对应的url分别为:<br> |
|||
* 新增: core/xmIterationLink/add <br> |
|||
* 查询: core/xmIterationLink/list<br> |
|||
* 模糊查询: core/xmIterationLink/listKey<br> |
|||
* 修改: core/xmIterationLink/edit <br> |
|||
* 删除: core/xmIterationLink/del<br> |
|||
* 批量删除: core/xmIterationLink/batchDel<br> |
|||
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
|||
* 实体 XmIterationLink 表 XM.xm_iteration_product_link 当前主键(包括多主键): iteration_id,product_id; |
|||
***/ |
|||
@RestController("xm.core.xmIterationLinkController") |
|||
@RequestMapping(value="/**/core/xmIterationLink") |
|||
@Api(tags={"迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表操作接口"}) |
|||
public class XmIterationLinkController { |
|||
|
|||
static Logger logger =LoggerFactory.getLogger(XmIterationLinkController.class); |
|||
|
|||
@Autowired |
|||
private XmIterationLinkService xmIterationLinkService; |
|||
|
|||
@Autowired |
|||
private XmIterationService xmIterationService; |
|||
|
|||
|
|||
@Autowired |
|||
private XmTaskService xmTaskService; |
|||
|
|||
|
|||
@Autowired |
|||
private XmMenuService xmMenuService; |
|||
|
|||
@Autowired |
|||
XmGroupService xmGroupService; |
|||
|
|||
|
|||
@ApiOperation( value = "查询迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息列表",notes=" ") |
|||
@ApiEntityParams(XmIterationLink.class) |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200,response= XmIterationLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
|||
}) |
|||
@RequestMapping(value="/list",method=RequestMethod.GET) |
|||
public Map<String,Object> listXmIterationLink( @ApiIgnore @RequestParam Map<String,Object> xmIterationLink){ |
|||
Map<String,Object> m = new HashMap<>(); |
|||
RequestUtils.transformArray(xmIterationLink, "iterationIdsproductIds"); |
|||
PageUtils.startPage(xmIterationLink); |
|||
List<Map<String,Object>> xmIterationLinkList = xmIterationLinkService.selectListMapByWhere(xmIterationLink); //列出XmIterationLink列表 |
|||
PageUtils.responePage(m, xmIterationLinkList); |
|||
m.put("data",xmIterationLinkList); |
|||
Tips tips=new Tips("查询成功"); |
|||
m.put("tips", tips); |
|||
return m; |
|||
} |
|||
@ApiOperation( value = "查询迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息列表",notes=" ") |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200,response= XmIterationLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
|||
}) |
|||
@RequestMapping(value="/listWithProductInfo",method=RequestMethod.GET) |
|||
public Map<String,Object> listWithProductInfo( @ApiIgnore @RequestParam Map<String,Object> xmIterationLink){ |
|||
Map<String,Object> m = new HashMap<>(); |
|||
RequestUtils.transformArray(xmIterationLink, "iterationIdsproductIds"); |
|||
PageUtils.startPage(xmIterationLink); |
|||
List<Map<String,Object>> xmIterationLinkList = xmIterationLinkService.listWithProductInfo(xmIterationLink); //列出XmIterationLink列表 |
|||
PageUtils.responePage(m, xmIterationLinkList); |
|||
m.put("data",xmIterationLinkList); |
|||
Tips tips=new Tips("查询成功"); |
|||
m.put("tips", tips); |
|||
return m; |
|||
} |
|||
@ApiOperation( value = "查询迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息列表",notes=" ") |
|||
@ApiEntityParams(XmIterationLink.class) |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200,response= XmIterationLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
|||
}) |
|||
@RequestMapping(value="/listWithProjectInfo",method=RequestMethod.GET) |
|||
public Map<String,Object> listWithProjectInfo( @ApiIgnore @RequestParam Map<String,Object> xmIterationLink){ |
|||
Map<String,Object> m = new HashMap<>(); |
|||
RequestUtils.transformArray(xmIterationLink, "pkList"); |
|||
PageUtils.startPage(xmIterationLink); |
|||
List<Map<String,Object>> xmIterationLinkList = xmIterationLinkService.listWithProjectInfo(xmIterationLink); //列出XmIterationLink列表 |
|||
PageUtils.responePage(m, xmIterationLinkList); |
|||
m.put("data",xmIterationLinkList); |
|||
Tips tips=new Tips("查询成功"); |
|||
m.put("tips", tips); |
|||
return m; |
|||
} |
|||
|
|||
|
|||
@ApiOperation( value = "新增一条迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息",notes=" ") |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200,response= XmIterationLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|||
}) |
|||
@RequestMapping(value="/add",method=RequestMethod.POST) |
|||
public Map<String,Object> addXmIterationLink(@RequestBody XmIterationLink xmIterationLink) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功新增一条数据"); |
|||
try{ |
|||
|
|||
if(StringUtils.isEmpty(xmIterationLink.getIterationId())) { |
|||
return ResponseHelper.failed("iterationId-0","请上送迭代编号"); |
|||
} |
|||
if(StringUtils.isEmpty(xmIterationLink.getProId())) { |
|||
return ResponseHelper.failed("proId-0","请上送产品编号或项目编号"); |
|||
} |
|||
|
|||
if(StringUtils.isEmpty(xmIterationLink.getLtype())) { |
|||
return ResponseHelper.failed("ltype-0","请上送关联类型"); |
|||
} |
|||
if(xmIterationLinkService.selectOneObject(xmIterationLink) !=null ){ |
|||
tips.setFailureMsg("该产品或者项目已经在迭代中,无需再添加"); |
|||
m.put("tips", tips); |
|||
return m; |
|||
} |
|||
User user= LoginUtils.getCurrentUserInfo(); |
|||
if("1".equals(xmIterationLink.getLtype())){ |
|||
if(!xmGroupService.checkUserIsProductAdm(xmIterationLink.getProId(),user.getUserid())){ |
|||
return ResponseHelper.failed("no-product-qx","您不是产品管理人员,无权将该产品与迭代关联"); |
|||
}; |
|||
}else if("0".equals(xmIterationLink.getLtype())){ |
|||
if(!xmGroupService.checkUserIsProjectAdm(xmIterationLink.getProId(),user.getUserid())){ |
|||
return ResponseHelper.failed("no-project-qx","您不是项目管理人员,无权将该项目与迭代关联"); |
|||
}; |
|||
}else{ |
|||
return ResponseHelper.failed("ltype-not-0|1","请上送正确的关联类型"); |
|||
} |
|||
|
|||
xmIterationLink.setCuserid(user.getUserid()); |
|||
xmIterationLink.setCusername(user.getUsername()); |
|||
xmIterationLink.setCtime(new Date()); |
|||
xmIterationLink.setLinkStatus("1"); |
|||
xmIterationLinkService.insert(xmIterationLink); |
|||
m.put("data",xmIterationLink); |
|||
}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> delXmIterationLink(@RequestBody XmIterationLink xmIterationLink){ |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功删除一条数据"); |
|||
try{ |
|||
if(StringUtils.isEmpty(xmIterationLink.getIterationId())) { |
|||
return ResponseHelper.failed("iterationId-0","请上送迭代编号"); |
|||
} |
|||
if(StringUtils.isEmpty(xmIterationLink.getProId())) { |
|||
return ResponseHelper.failed("proId-0","请上送产品编号或项目编号"); |
|||
} |
|||
xmIterationLink=this.xmIterationLinkService.selectOneObject(xmIterationLink); |
|||
if(xmIterationLink==null){ |
|||
return ResponseHelper.failed("data-0","该关联关系已不存在"); |
|||
} |
|||
User user= LoginUtils.getCurrentUserInfo(); |
|||
if("1".equals(xmIterationLink.getLtype())){ |
|||
if(!xmGroupService.checkUserIsProductAdm(xmIterationLink.getProId(),user.getUserid())){ |
|||
return ResponseHelper.failed("no-product-qx","您不是产品管理人员,无权将该产品移出迭代"); |
|||
}; |
|||
//检查是否有需求关联这个迭代,如果有,不允许删除 |
|||
List<XmMenu> menus= xmMenuService.listTenMenuByProductIdAndIterationId(xmIterationLink.getProId(),xmIterationLink.getIterationId()); |
|||
if(menus!=null && menus.size()>0){ |
|||
return ResponseHelper.failed("menus-not-0","存在至少"+menus.size()+"个需求与迭代关联,不能移出.关联需求【"+menus.stream().map(i->i.getMenuName()).collect(Collectors.joining(","))+"】"); |
|||
} |
|||
}else if("0".equals(xmIterationLink.getLtype())){ |
|||
if(!xmGroupService.checkUserIsProjectAdm(xmIterationLink.getProId(),user.getUserid())){ |
|||
return ResponseHelper.failed("no-project-qx","您不是项目管理人员,无权将该项目移出迭代"); |
|||
}; |
|||
//检查是否有任务关联这个迭代,如果有,不允许删除 |
|||
List<XmTask> tasks= xmTaskService.listTenTaskByProjectIdAndIterationId(xmIterationLink.getProId(),xmIterationLink.getIterationId()); |
|||
if(tasks!=null && tasks.size()>0){ |
|||
return ResponseHelper.failed("tasks-not-0","存在至少"+tasks.size()+"个任务与迭代关联,不能移出.关联任务【"+tasks.stream().map(i->i.getName()).collect(Collectors.joining(","))+"】"); |
|||
} |
|||
}else{ |
|||
return ResponseHelper.failed("ltype-not-0|1","请上送正确的关联类型"); |
|||
} |
|||
|
|||
|
|||
xmIterationLinkService.deleteByPk(xmIterationLink); |
|||
}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=XmIterationLink.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|||
}) |
|||
@RequestMapping(value="/edit",method=RequestMethod.POST) |
|||
public Map<String,Object> editXmIterationLink(@RequestBody XmIterationLink xmIterationLink) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功更新一条数据"); |
|||
try{ |
|||
xmIterationLinkService.updateByPk(xmIterationLink); |
|||
m.put("data",xmIterationLink); |
|||
}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> batchDelXmIterationLink(@RequestBody List<XmIterationLink> xmIterationLinks) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功删除"+xmIterationLinks.size()+"条数据"); |
|||
try{ |
|||
xmIterationLinkService.batchDelete(xmIterationLinks); |
|||
}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; |
|||
} |
|||
*/ |
|||
} |
|||
@ -1,57 +0,0 @@ |
|||
package com.xm.core.entity; |
|||
|
|||
import lombok.Data; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
|||
* 实体 XmIterationLink所有属性名: <br> |
|||
* "iterationId","迭代表主键","proId","产品或者项目表主键","ctime","创建时间","cuserid","创建人编号","cusername","创建人姓名","linkStatus","关联状态1关联0取消关联","ltype","关联类型0-项目,1-产品,为了简化,只关联产品,无须关联项目;项目通过产品关联";<br> |
|||
* 当前主键(包括多主键):<br> |
|||
* iteration_id,pro_id;<br> |
|||
*/ |
|||
@Data |
|||
@ApiModel(description="迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表") |
|||
public class XmIterationLink implements java.io.Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty(notes="迭代表主键,主键",allowEmptyValue=true,example="",allowableValues="") |
|||
String iterationId; |
|||
|
|||
@ApiModelProperty(notes="产品或者项目表主键,主键",allowEmptyValue=true,example="",allowableValues="") |
|||
String proId; |
|||
|
|||
|
|||
@ApiModelProperty(notes="创建时间",allowEmptyValue=true,example="",allowableValues="") |
|||
Date ctime; |
|||
|
|||
@ApiModelProperty(notes="创建人编号",allowEmptyValue=true,example="",allowableValues="") |
|||
String cuserid; |
|||
|
|||
@ApiModelProperty(notes="创建人姓名",allowEmptyValue=true,example="",allowableValues="") |
|||
String cusername; |
|||
|
|||
@ApiModelProperty(notes="关联状态1关联0取消关联",allowEmptyValue=true,example="",allowableValues="") |
|||
String linkStatus; |
|||
|
|||
@ApiModelProperty(notes="关联类型0-项目,1-产品,为了简化,只关联产品,无须关联项目;项目通过产品关联",allowEmptyValue=true,example="",allowableValues="") |
|||
String ltype; |
|||
|
|||
/** |
|||
*迭代表主键,产品或者项目表主键 |
|||
**/ |
|||
public XmIterationLink(String iterationId,String proId) { |
|||
this.iterationId = iterationId; |
|||
this.proId = proId; |
|||
} |
|||
|
|||
/** |
|||
* 迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表 |
|||
**/ |
|||
public XmIterationLink() { |
|||
} |
|||
|
|||
} |
|||
@ -1,36 +0,0 @@ |
|||
package com.xm.core.service; |
|||
|
|||
import com.mdp.core.service.BaseService; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br> |
|||
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
|||
* 实体 XmIterationLink 表 XM.xm_iteration_product_link 当前主键(包括多主键): iteration_id,product_id; |
|||
***/ |
|||
@Service("xm.core.xmIterationLinkService") |
|||
public class XmIterationLinkService extends BaseService { |
|||
|
|||
|
|||
|
|||
|
|||
static Logger logger =LoggerFactory.getLogger(XmIterationLinkService.class); |
|||
|
|||
public List<Map<String, Object>> listWithProductInfo(Map<String, Object> xmIterationLink) { |
|||
return super.selectList("listWithProductInfo",xmIterationLink); |
|||
} |
|||
|
|||
public List<Map<String, Object>> listWithProjectInfo(Map<String, Object> xmIterationLink) { |
|||
return super.selectList("listWithProjectInfo",xmIterationLink); |
|||
} |
|||
/** 请在此类添加自定义函数 */ |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
@ -1,21 +1,7 @@ |
|||
package com.xm.core.vo; |
|||
|
|||
import com.xm.core.entity.XmIteration; |
|||
import com.xm.core.entity.XmIterationLink; |
|||
|
|||
import java.util.List; |
|||
|
|||
public class XmIterationVo extends XmIteration { |
|||
|
|||
|
|||
|
|||
List<XmIterationLink> links; |
|||
|
|||
public List<XmIterationLink> getLinks() { |
|||
return links; |
|||
} |
|||
|
|||
public void setLinks(List<XmIterationLink> links) { |
|||
this.links = links; |
|||
} |
|||
} |
|||
@ -1,201 +0,0 @@ |
|||
<?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.XmIterationLink"> |
|||
|
|||
|
|||
<!--开始 自定sql函数区域 请在此区域添加自定义函数,其它区域尽量不要动,因为代码随时重新生成 --> |
|||
|
|||
<sql id="whereForMap"> |
|||
<if test=" pkList != null"> and (res.iteration_id, res.pro_id) in |
|||
<foreach collection="pkList" item="item" index="index" open="(" separator="," close=")" > |
|||
( #{item.iterationId}, #{item.proId}) |
|||
</foreach> |
|||
</if> |
|||
<if test="key != null and key !='' "> </if> |
|||
</sql> |
|||
|
|||
|
|||
<select id="listWithProjectInfo" parameterType="HashMap" resultType="HashMap"> |
|||
select res.*,p.name as project_name,p.id as project_id from xm_iteration res inner join xm_product_project_link ppl on res.product_id=ppl.product_id |
|||
inner join xm_project p on p.id=ppl.project_id |
|||
<where> |
|||
<include refid="whereForMap"/> |
|||
<include refid="where"/> |
|||
</where> |
|||
order by res.seq_no desc |
|||
</select> |
|||
<select id="listWithProductInfo" parameterType="HashMap" resultType="HashMap"> |
|||
select res.*,p.product_name,p.id as product_id from xm_product p |
|||
inner join xm_iteration res on res.product_id=p.id |
|||
<where> |
|||
<include refid="whereForMap"/> |
|||
<include refid="where"/> |
|||
</where> |
|||
order by res.seq_no desc |
|||
</select> |
|||
<!--结束 自定义sql函数区域--> |
|||
|
|||
|
|||
|
|||
<!-- 通过条件查询获取数据列表 返回list<map> --> |
|||
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap"> |
|||
select * from xm_iteration_link res |
|||
<where> |
|||
<include refid="whereForMap"/> |
|||
<include refid="where"/> |
|||
</where> |
|||
</select> |
|||
|
|||
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> --> |
|||
<select id="selectListByWhere" parameterType="com.xm.core.entity.XmIterationLink" resultType="com.xm.core.entity.XmIterationLink"> |
|||
select * from xm_iteration_link res |
|||
<where> |
|||
<include refid="where"/> |
|||
</where> |
|||
</select> |
|||
|
|||
<!-- 通过主键查询获取数据对象 返回object --> |
|||
<select id="selectOneObject" parameterType="com.xm.core.entity.XmIterationLink" resultType="com.xm.core.entity.XmIterationLink"> |
|||
select * from xm_iteration_link res |
|||
where |
|||
res.iteration_id = #{iterationId} |
|||
and res.pro_id = #{proId} |
|||
</select> |
|||
<select id="selectListByIds" parameterType="List" resultType="com.xm.core.entity.XmIterationLink"> |
|||
select * from xm_iteration_link res |
|||
where (res.iteration_id, res.pro_id) in |
|||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
|||
( #{item.iterationId}, #{item.proId}) |
|||
</foreach> |
|||
</select> |
|||
<!-- 通过主键查询获取数据对象 返回map--> |
|||
<select id="selectOneMap" parameterType="HashMap" resultType="HashMap"> |
|||
select * from xm_iteration_link res |
|||
where |
|||
res.iteration_id = #{iterationId} |
|||
and res.pro_id = #{proId} |
|||
</select> |
|||
<!-- 获取数据条目 返回long --> |
|||
<select id="countByWhere" parameterType="com.xm.core.entity.XmIterationLink" resultType="long"> |
|||
select count(*) from xm_iteration_link res |
|||
<where> |
|||
<include refid="where"/> |
|||
</where> |
|||
</select> |
|||
<!-- 新增一条记录 主键iteration_id,pro_id,--> |
|||
<insert id="insert" parameterType="com.xm.core.entity.XmIterationLink" useGeneratedKeys="false" > |
|||
insert into xm_iteration_link( |
|||
<include refid="columns"/> |
|||
) values ( |
|||
#{iterationId},#{proId},#{ctime},#{cuserid},#{cusername},#{linkStatus},#{ltype} |
|||
) |
|||
</insert> |
|||
|
|||
<!-- 按条件删除若干条记录--> |
|||
<delete id="deleteByWhere" parameterType="com.xm.core.entity.XmIterationLink"> |
|||
delete from xm_iteration_link res |
|||
<where> |
|||
<include refid="where"/> |
|||
</where> |
|||
</delete> |
|||
|
|||
<!-- 按主键删除一条记录--> |
|||
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmIterationLink"> |
|||
delete from xm_iteration_link |
|||
where iteration_id = #{iterationId} and pro_id = #{proId} |
|||
</delete> |
|||
|
|||
<!-- 根据条件修改若干条记录 --> |
|||
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmIterationLink"> |
|||
update xm_iteration_link |
|||
<set> |
|||
<include refid="someFieldSet"/> |
|||
</set> |
|||
where iteration_id = #{iterationId} and pro_id = #{proId} |
|||
</update> |
|||
|
|||
<!-- 根据主键修改一条记录 --> |
|||
<update id="updateByPk" parameterType="com.xm.core.entity.XmIterationLink"> |
|||
update xm_iteration_link |
|||
<set> |
|||
<include refid="set"/> |
|||
</set> |
|||
where iteration_id = #{iterationId} and pro_id = #{proId} |
|||
</update> |
|||
|
|||
<!-- 批量新增 批量插入 借用insert 循环插入实现 |
|||
<insert id="batchInsert" parameterType="List"> |
|||
</insert> |
|||
--> |
|||
|
|||
<!-- 批量更新 --> |
|||
<update id="batchUpdate" parameterType="List"> |
|||
<foreach collection="list" item="item" index="index" separator=";" > |
|||
update xm_iteration_link |
|||
set |
|||
<include refid="batchSet"/> |
|||
where iteration_id = #{item.iterationId} and pro_id = #{item.proId} |
|||
</foreach> |
|||
</update> |
|||
|
|||
<!-- 批量修改某几个字段 --> |
|||
<delete id="editSomeFields" parameterType="HashMap"> |
|||
update xm_iteration_link |
|||
<set> |
|||
<include refid="someFieldSet"/> |
|||
</set> |
|||
where (iteration_id, pro_id) in |
|||
<foreach collection="pkList" item="item" index="index" open="(" separator="," close=")" > |
|||
( #{item.iterationId}, #{item.proId}) |
|||
</foreach> |
|||
</delete> |
|||
<!-- 批量删除 --> |
|||
<delete id="batchDelete" parameterType="List"> |
|||
delete from xm_iteration_link |
|||
where |
|||
(iteration_id, pro_id) in |
|||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
|||
( #{item.iterationId}, #{item.proId} ) |
|||
</foreach> |
|||
</delete> |
|||
|
|||
|
|||
<!--sql片段 列--> |
|||
<sql id="columns"> |
|||
iteration_id,pro_id,ctime,cuserid,cusername,link_status,ltype |
|||
</sql> |
|||
|
|||
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS--> |
|||
<sql id="where"> |
|||
<if test="iterationId != null and iterationId != ''"> and res.iteration_id = #{iterationId} </if> |
|||
<if test="proId != null and proId != ''"> and res.pro_id = #{proId} </if> |
|||
<if test="ctime != null"> and date_format(res.ctime,'%Y-%m-%d') = date_format(#{ctime},'%Y-%m-%d') </if> |
|||
<if test="cuserid != null and cuserid != ''"> and res.cuserid = #{cuserid} </if> |
|||
<if test="cusername != null and cusername != ''"> and res.cusername = #{cusername} </if> |
|||
<if test="linkStatus != null and linkStatus != ''"> and res.link_status = #{linkStatus} </if> |
|||
<if test="ltype != null and ltype != ''"> and res.ltype = #{ltype} </if> |
|||
</sql> |
|||
<!--sql片段 更新字段 --> |
|||
<sql id="set"> |
|||
ctime = #{ctime}, |
|||
cuserid = #{cuserid}, |
|||
cusername = #{cusername}, |
|||
link_status = #{linkStatus}, |
|||
ltype = #{ltype} |
|||
</sql> |
|||
<sql id="someFieldSet"> |
|||
<if test="ctime != null"> ctime = #{ctime}, </if> |
|||
<if test="cuserid != null and cuserid != ''"> cuserid = #{cuserid}, </if> |
|||
<if test="cusername != null and cusername != ''"> cusername = #{cusername}, </if> |
|||
<if test="linkStatus != null and linkStatus != ''"> link_status = #{linkStatus}, </if> |
|||
<if test="ltype != null and ltype != ''"> ltype = #{ltype}, </if> |
|||
</sql> |
|||
<!--sql片段 批量更新 --> |
|||
<sql id="batchSet"> |
|||
ctime = #{item.ctime}, |
|||
cuserid = #{item.cuserid}, |
|||
cusername = #{item.cusername}, |
|||
link_status = #{item.linkStatus}, |
|||
ltype = #{item.ltype} |
|||
</sql> |
|||
</mapper> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue