16 changed files with 1452 additions and 1 deletions
-
188xm-core/src/main/java/com/xm/core/ctrl/XmIterationProductLinkController.java
-
184xm-core/src/main/java/com/xm/core/ctrl/XmProductProjectLinkController.java
-
124xm-core/src/main/java/com/xm/core/entity/XmIterationProductLink.java
-
123xm-core/src/main/java/com/xm/core/entity/XmProductProjectLink.java
-
21xm-core/src/main/java/com/xm/core/service/XmIterationProductLinkService.java
-
21xm-core/src/main/java/com/xm/core/service/XmProductProjectLinkService.java
-
162xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationProductLinkMapper.xml
-
2xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductMapper.xml
-
163xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductProjectLinkMapper.xml
-
3xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectPhaseMapper.xml
-
127xm-core/src/test/java/com/xm/core/ctrl/TestXmIterationProductLinkController.java
-
127xm-core/src/test/java/com/xm/core/ctrl/TestXmProductProjectLinkController.java
-
51xm-core/src/test/java/com/xm/core/dao/TestXmIterationProductLinkDao.java
-
51xm-core/src/test/java/com/xm/core/dao/TestXmProductProjectLinkDao.java
-
53xm-core/src/test/java/com/xm/core/service/TestXmIterationProductLinkService.java
-
53xm-core/src/test/java/com/xm/core/service/TestXmProductProjectLinkService.java
@ -0,0 +1,188 @@ |
|||
package com.xm.core.ctrl; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
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.ModelAttribute; |
|||
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 org.springframework.stereotype.Controller; |
|||
|
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiImplicitParam; |
|||
import io.swagger.annotations.ApiImplicitParams; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiResponse; |
|||
import io.swagger.annotations.ApiResponses; |
|||
|
|||
import com.mdp.mybatis.PageUtils; |
|||
import com.mdp.core.entity.Tips; |
|||
import com.mdp.core.err.BizException; |
|||
import com.mdp.core.utils.BaseUtils; |
|||
import com.mdp.core.utils.RequestUtils; |
|||
import com.xm.core.service.XmIterationProductLinkService; |
|||
import com.xm.core.entity.XmIterationProductLink; |
|||
/** |
|||
* url编制采用rest风格,如对XM.xm_iteration_product_link 迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表的操作有增删改查,对应的url分别为:<br> |
|||
* 新增: core/xmIterationProductLink/add <br> |
|||
* 查询: core/xmIterationProductLink/list<br> |
|||
* 模糊查询: core/xmIterationProductLink/listKey<br> |
|||
* 修改: core/xmIterationProductLink/edit <br> |
|||
* 删除: core/xmIterationProductLink/del<br> |
|||
* 批量删除: core/xmIterationProductLink/batchDel<br> |
|||
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
|||
* 实体 XmIterationProductLink 表 XM.xm_iteration_product_link 当前主键(包括多主键): iteration_id,product_id; |
|||
***/ |
|||
@RestController("xm.core.xmIterationProductLinkController") |
|||
@RequestMapping(value="/**/core/xmIterationProductLink") |
|||
@Api(tags={"迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表操作接口"}) |
|||
public class XmIterationProductLinkController { |
|||
|
|||
static Logger logger =LoggerFactory.getLogger(XmIterationProductLinkController.class); |
|||
|
|||
@Autowired |
|||
private XmIterationProductLinkService xmIterationProductLinkService; |
|||
|
|||
|
|||
|
|||
|
|||
@ApiOperation( value = "查询迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息列表",notes=" ") |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200,response=XmIterationProductLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
|||
}) |
|||
@RequestMapping(value="/list",method=RequestMethod.GET) |
|||
public Map<String,Object> listXmIterationProductLink( @RequestParam Map<String,Object> xmIterationProductLink){ |
|||
Map<String,Object> m = new HashMap<>(); |
|||
RequestUtils.transformArray(xmIterationProductLink, "iterationIdsproductIds"); |
|||
PageUtils.startPage(xmIterationProductLink); |
|||
List<Map<String,Object>> xmIterationProductLinkList = xmIterationProductLinkService.selectListMapByWhere(xmIterationProductLink); //列出XmIterationProductLink列表 |
|||
PageUtils.responePage(m, xmIterationProductLinkList); |
|||
m.put("data",xmIterationProductLinkList); |
|||
Tips tips=new Tips("查询成功"); |
|||
m.put("tips", tips); |
|||
return m; |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
@ApiOperation( value = "新增一条迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息",notes=" ") |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200,response=XmIterationProductLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|||
}) |
|||
@RequestMapping(value="/add",method=RequestMethod.POST) |
|||
public Map<String,Object> addXmIterationProductLink(@RequestBody XmIterationProductLink xmIterationProductLink) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功新增一条数据"); |
|||
try{ |
|||
boolean createPk=false; |
|||
if(StringUtils.isEmpty(xmIterationProductLink.getIterationId())) { |
|||
createPk=true; |
|||
xmIterationProductLink.setIterationId(xmIterationProductLinkService.createKey("iterationId")); |
|||
} |
|||
if(StringUtils.isEmpty(xmIterationProductLink.getProductId())) { |
|||
createPk=true; |
|||
xmIterationProductLink.setProductId(xmIterationProductLinkService.createKey("productId")); |
|||
} |
|||
if(createPk==false){ |
|||
if(xmIterationProductLinkService.selectOneObject(xmIterationProductLink) !=null ){ |
|||
tips.setFailureMsg("编号重复,请修改编号再提交"); |
|||
m.put("tips", tips); |
|||
return m; |
|||
} |
|||
} |
|||
xmIterationProductLinkService.insert(xmIterationProductLink); |
|||
m.put("data",xmIterationProductLink); |
|||
}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> delXmIterationProductLink(@RequestBody XmIterationProductLink xmIterationProductLink){ |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功删除一条数据"); |
|||
try{ |
|||
xmIterationProductLinkService.deleteByPk(xmIterationProductLink); |
|||
}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=XmIterationProductLink.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|||
}) |
|||
@RequestMapping(value="/edit",method=RequestMethod.POST) |
|||
public Map<String,Object> editXmIterationProductLink(@RequestBody XmIterationProductLink xmIterationProductLink) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功更新一条数据"); |
|||
try{ |
|||
xmIterationProductLinkService.updateByPk(xmIterationProductLink); |
|||
m.put("data",xmIterationProductLink); |
|||
}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> batchDelXmIterationProductLink(@RequestBody List<XmIterationProductLink> xmIterationProductLinks) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功删除"+xmIterationProductLinks.size()+"条数据"); |
|||
try{ |
|||
xmIterationProductLinkService.batchDelete(xmIterationProductLinks); |
|||
}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,184 @@ |
|||
package com.xm.core.ctrl; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
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.ModelAttribute; |
|||
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 org.springframework.stereotype.Controller; |
|||
|
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiImplicitParam; |
|||
import io.swagger.annotations.ApiImplicitParams; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiResponse; |
|||
import io.swagger.annotations.ApiResponses; |
|||
|
|||
import com.mdp.mybatis.PageUtils; |
|||
import com.mdp.core.entity.Tips; |
|||
import com.mdp.core.err.BizException; |
|||
import com.mdp.core.utils.BaseUtils; |
|||
import com.mdp.core.utils.RequestUtils; |
|||
import com.xm.core.service.XmProductProjectLinkService; |
|||
import com.xm.core.entity.XmProductProjectLink; |
|||
/** |
|||
* url编制采用rest风格,如对XM.xm_product_project_link 产品与项目的关联关系表,一般由产品经理挂接项目到产品上的操作有增删改查,对应的url分别为:<br> |
|||
* 新增: core/xmProductProjectLink/add <br> |
|||
* 查询: core/xmProductProjectLink/list<br> |
|||
* 模糊查询: core/xmProductProjectLink/listKey<br> |
|||
* 修改: core/xmProductProjectLink/edit <br> |
|||
* 删除: core/xmProductProjectLink/del<br> |
|||
* 批量删除: core/xmProductProjectLink/batchDel<br> |
|||
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
|||
* 实体 XmProductProjectLink 表 XM.xm_product_project_link 当前主键(包括多主键): project_id; |
|||
***/ |
|||
@RestController("xm.core.xmProductProjectLinkController") |
|||
@RequestMapping(value="/**/core/xmProductProjectLink") |
|||
@Api(tags={"产品与项目的关联关系表,一般由产品经理挂接项目到产品上操作接口"}) |
|||
public class XmProductProjectLinkController { |
|||
|
|||
static Logger logger =LoggerFactory.getLogger(XmProductProjectLinkController.class); |
|||
|
|||
@Autowired |
|||
private XmProductProjectLinkService xmProductProjectLinkService; |
|||
|
|||
|
|||
|
|||
|
|||
@ApiOperation( value = "查询产品与项目的关联关系表,一般由产品经理挂接项目到产品上信息列表",notes=" ") |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200,response=XmProductProjectLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
|||
}) |
|||
@RequestMapping(value="/list",method=RequestMethod.GET) |
|||
public Map<String,Object> listXmProductProjectLink( @RequestParam Map<String,Object> xmProductProjectLink){ |
|||
Map<String,Object> m = new HashMap<>(); |
|||
RequestUtils.transformArray(xmProductProjectLink, "projectIds"); |
|||
PageUtils.startPage(xmProductProjectLink); |
|||
List<Map<String,Object>> xmProductProjectLinkList = xmProductProjectLinkService.selectListMapByWhere(xmProductProjectLink); //列出XmProductProjectLink列表 |
|||
PageUtils.responePage(m, xmProductProjectLinkList); |
|||
m.put("data",xmProductProjectLinkList); |
|||
Tips tips=new Tips("查询成功"); |
|||
m.put("tips", tips); |
|||
return m; |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
@ApiOperation( value = "新增一条产品与项目的关联关系表,一般由产品经理挂接项目到产品上信息",notes=" ") |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200,response=XmProductProjectLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|||
}) |
|||
@RequestMapping(value="/add",method=RequestMethod.POST) |
|||
public Map<String,Object> addXmProductProjectLink(@RequestBody XmProductProjectLink xmProductProjectLink) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功新增一条数据"); |
|||
try{ |
|||
boolean createPk=false; |
|||
if(StringUtils.isEmpty(xmProductProjectLink.getProjectId())) { |
|||
createPk=true; |
|||
xmProductProjectLink.setProjectId(xmProductProjectLinkService.createKey("projectId")); |
|||
} |
|||
if(createPk==false){ |
|||
if(xmProductProjectLinkService.selectOneObject(xmProductProjectLink) !=null ){ |
|||
tips.setFailureMsg("编号重复,请修改编号再提交"); |
|||
m.put("tips", tips); |
|||
return m; |
|||
} |
|||
} |
|||
xmProductProjectLinkService.insert(xmProductProjectLink); |
|||
m.put("data",xmProductProjectLink); |
|||
}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> delXmProductProjectLink(@RequestBody XmProductProjectLink xmProductProjectLink){ |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功删除一条数据"); |
|||
try{ |
|||
xmProductProjectLinkService.deleteByPk(xmProductProjectLink); |
|||
}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=XmProductProjectLink.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|||
}) |
|||
@RequestMapping(value="/edit",method=RequestMethod.POST) |
|||
public Map<String,Object> editXmProductProjectLink(@RequestBody XmProductProjectLink xmProductProjectLink) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功更新一条数据"); |
|||
try{ |
|||
xmProductProjectLinkService.updateByPk(xmProductProjectLink); |
|||
m.put("data",xmProductProjectLink); |
|||
}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> batchDelXmProductProjectLink(@RequestBody List<XmProductProjectLink> xmProductProjectLinks) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功删除"+xmProductProjectLinks.size()+"条数据"); |
|||
try{ |
|||
xmProductProjectLinkService.batchDelete(xmProductProjectLinks); |
|||
}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,124 @@ |
|||
package com.xm.core.entity; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
|||
* 实体 XmIterationProductLink所有属性名: <br> |
|||
* iterationId,productId,ctime,cuserid,cusername,linkStatus;<br> |
|||
* 表 XM.xm_iteration_product_link 迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表的所有字段名: <br> |
|||
* iteration_id,product_id,ctime,cuserid,cusername,link_status;<br> |
|||
* 当前主键(包括多主键):<br> |
|||
* iteration_id,product_id;<br> |
|||
*/ |
|||
@ApiModel(description="迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表") |
|||
public class XmIterationProductLink 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 productId; |
|||
|
|||
|
|||
@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; |
|||
|
|||
/**迭代表主键,产品表主键**/ |
|||
public XmIterationProductLink(String iterationId,String productId) { |
|||
this.iterationId = iterationId; |
|||
this.productId = productId; |
|||
} |
|||
|
|||
/**迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表**/ |
|||
public XmIterationProductLink() { |
|||
} |
|||
|
|||
/** |
|||
* 迭代表主键 |
|||
**/ |
|||
public void setIterationId(String iterationId) { |
|||
this.iterationId = iterationId; |
|||
} |
|||
/** |
|||
* 产品表主键 |
|||
**/ |
|||
public void setProductId(String productId) { |
|||
this.productId = productId; |
|||
} |
|||
/** |
|||
* 创建时间 |
|||
**/ |
|||
public void setCtime(Date ctime) { |
|||
this.ctime = ctime; |
|||
} |
|||
/** |
|||
* 创建人编号 |
|||
**/ |
|||
public void setCuserid(String cuserid) { |
|||
this.cuserid = cuserid; |
|||
} |
|||
/** |
|||
* 创建人姓名 |
|||
**/ |
|||
public void setCusername(String cusername) { |
|||
this.cusername = cusername; |
|||
} |
|||
/** |
|||
* 关联状态1关联0取消关联 |
|||
**/ |
|||
public void setLinkStatus(String linkStatus) { |
|||
this.linkStatus = linkStatus; |
|||
} |
|||
|
|||
/** |
|||
* 迭代表主键 |
|||
**/ |
|||
public String getIterationId() { |
|||
return this.iterationId; |
|||
} |
|||
/** |
|||
* 产品表主键 |
|||
**/ |
|||
public String getProductId() { |
|||
return this.productId; |
|||
} |
|||
/** |
|||
* 创建时间 |
|||
**/ |
|||
public Date getCtime() { |
|||
return this.ctime; |
|||
} |
|||
/** |
|||
* 创建人编号 |
|||
**/ |
|||
public String getCuserid() { |
|||
return this.cuserid; |
|||
} |
|||
/** |
|||
* 创建人姓名 |
|||
**/ |
|||
public String getCusername() { |
|||
return this.cusername; |
|||
} |
|||
/** |
|||
* 关联状态1关联0取消关联 |
|||
**/ |
|||
public String getLinkStatus() { |
|||
return this.linkStatus; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,123 @@ |
|||
package com.xm.core.entity; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
|||
* 实体 XmProductProjectLink所有属性名: <br> |
|||
* projectId,productId,ctime,cuserid,cusername,linkStatus;<br> |
|||
* 表 XM.xm_product_project_link 产品与项目的关联关系表,一般由产品经理挂接项目到产品上的所有字段名: <br> |
|||
* project_id,product_id,ctime,cuserid,cusername,link_status;<br> |
|||
* 当前主键(包括多主键):<br> |
|||
* project_id;<br> |
|||
*/ |
|||
@ApiModel(description="产品与项目的关联关系表,一般由产品经理挂接项目到产品上") |
|||
public class XmProductProjectLink implements java.io.Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty(notes="项目表中的主键,主键",allowEmptyValue=true,example="",allowableValues="") |
|||
String projectId; |
|||
|
|||
|
|||
@ApiModelProperty(notes="产品表中的主键",allowEmptyValue=true,example="",allowableValues="") |
|||
String productId; |
|||
|
|||
@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; |
|||
|
|||
/**项目表中的主键**/ |
|||
public XmProductProjectLink(String projectId) { |
|||
this.projectId = projectId; |
|||
} |
|||
|
|||
/**产品与项目的关联关系表,一般由产品经理挂接项目到产品上**/ |
|||
public XmProductProjectLink() { |
|||
} |
|||
|
|||
/** |
|||
* 项目表中的主键 |
|||
**/ |
|||
public void setProjectId(String projectId) { |
|||
this.projectId = projectId; |
|||
} |
|||
/** |
|||
* 产品表中的主键 |
|||
**/ |
|||
public void setProductId(String productId) { |
|||
this.productId = productId; |
|||
} |
|||
/** |
|||
* 创建时间 |
|||
**/ |
|||
public void setCtime(Date ctime) { |
|||
this.ctime = ctime; |
|||
} |
|||
/** |
|||
* 创建人编号 |
|||
**/ |
|||
public void setCuserid(String cuserid) { |
|||
this.cuserid = cuserid; |
|||
} |
|||
/** |
|||
* 创建人姓名 |
|||
**/ |
|||
public void setCusername(String cusername) { |
|||
this.cusername = cusername; |
|||
} |
|||
/** |
|||
* 关联状态1关联0取消关联 |
|||
**/ |
|||
public void setLinkStatus(String linkStatus) { |
|||
this.linkStatus = linkStatus; |
|||
} |
|||
|
|||
/** |
|||
* 项目表中的主键 |
|||
**/ |
|||
public String getProjectId() { |
|||
return this.projectId; |
|||
} |
|||
/** |
|||
* 产品表中的主键 |
|||
**/ |
|||
public String getProductId() { |
|||
return this.productId; |
|||
} |
|||
/** |
|||
* 创建时间 |
|||
**/ |
|||
public Date getCtime() { |
|||
return this.ctime; |
|||
} |
|||
/** |
|||
* 创建人编号 |
|||
**/ |
|||
public String getCuserid() { |
|||
return this.cuserid; |
|||
} |
|||
/** |
|||
* 创建人姓名 |
|||
**/ |
|||
public String getCusername() { |
|||
return this.cusername; |
|||
} |
|||
/** |
|||
* 关联状态1关联0取消关联 |
|||
**/ |
|||
public String getLinkStatus() { |
|||
return this.linkStatus; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
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 com.xm.core.entity.XmIterationProductLink; |
|||
/** |
|||
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br> |
|||
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
|||
* 实体 XmIterationProductLink 表 XM.xm_iteration_product_link 当前主键(包括多主键): iteration_id,product_id; |
|||
***/ |
|||
@Service("xm.core.xmIterationProductLinkService") |
|||
public class XmIterationProductLinkService extends BaseService { |
|||
static Logger logger =LoggerFactory.getLogger(XmIterationProductLinkService.class); |
|||
/** 请在此类添加自定义函数 */ |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,21 @@ |
|||
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 com.xm.core.entity.XmProductProjectLink; |
|||
/** |
|||
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br> |
|||
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
|||
* 实体 XmProductProjectLink 表 XM.xm_product_project_link 当前主键(包括多主键): project_id; |
|||
***/ |
|||
@Service("xm.core.xmProductProjectLinkService") |
|||
public class XmProductProjectLinkService extends BaseService { |
|||
static Logger logger =LoggerFactory.getLogger(XmProductProjectLinkService.class); |
|||
/** 请在此类添加自定义函数 */ |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,162 @@ |
|||
<?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.XmIterationProductLink"> |
|||
|
|||
|
|||
<!--开始 自定sql函数区域 --> |
|||
<!--请在此区域添加自定义函数--> |
|||
|
|||
|
|||
|
|||
<!--结束 自定义sql函数区域--> |
|||
|
|||
|
|||
|
|||
<!-- 通过条件查询获取数据列表 返回list<map> --> |
|||
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap"> |
|||
select * from XM.xm_iteration_product_link res |
|||
<where> |
|||
<if test="ids != null"> and |
|||
iteration_id in |
|||
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
|||
#{item} |
|||
</foreach> |
|||
</if> |
|||
<include refid="where"/> |
|||
<if test="key != null and key !='' "> </if> |
|||
</where> |
|||
</select> |
|||
|
|||
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> --> |
|||
<select id="selectListByWhere" parameterType="com.xm.core.entity.XmIterationProductLink" resultType="com.xm.core.entity.XmIterationProductLink"> |
|||
select * from XM.xm_iteration_product_link res |
|||
<where> |
|||
<include refid="where"/> |
|||
</where> |
|||
</select> |
|||
|
|||
<!-- 通过主键查询获取数据对象 返回object --> |
|||
<select id="selectOneObject" parameterType="com.xm.core.entity.XmIterationProductLink" resultType="com.xm.core.entity.XmIterationProductLink"> |
|||
select * from XM.xm_iteration_product_link res |
|||
where |
|||
res.iteration_id = #{iterationId} |
|||
and res.product_id = #{productId} |
|||
</select> |
|||
|
|||
<!-- 通过主键查询获取数据对象 返回map--> |
|||
<select id="selectOneMap" parameterType="HashMap" resultType="HashMap"> |
|||
select * from XM.xm_iteration_product_link res |
|||
where |
|||
res.iteration_id = #{iterationId} |
|||
and res.product_id = #{productId} |
|||
</select> |
|||
<!-- 获取数据条目 返回long --> |
|||
<select id="countByWhere" parameterType="com.xm.core.entity.XmIterationProductLink" resultType="long"> |
|||
select count(1) from XM.xm_iteration_product_link res |
|||
<where> |
|||
<include refid="where"/> |
|||
</where> |
|||
</select> |
|||
<!-- 新增一条记录 主键iteration_id,product_id,--> |
|||
<insert id="insert" parameterType="com.xm.core.entity.XmIterationProductLink" useGeneratedKeys="false" > |
|||
insert into XM.xm_iteration_product_link( |
|||
<include refid="columns"/> |
|||
) values ( |
|||
#{iterationId},#{productId},#{ctime},#{cuserid},#{cusername},#{linkStatus} |
|||
) |
|||
</insert> |
|||
|
|||
<!-- 按条件删除若干条记录--> |
|||
<delete id="deleteByWhere" parameterType="com.xm.core.entity.XmIterationProductLink"> |
|||
delete from XM.xm_iteration_product_link |
|||
<where> |
|||
1=2 |
|||
</where> |
|||
</delete> |
|||
|
|||
<!-- 按主键删除一条记录--> |
|||
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmIterationProductLink"> |
|||
delete from XM.xm_iteration_product_link |
|||
where iteration_id = #{iterationId} and product_id = #{productId} |
|||
</delete> |
|||
|
|||
<!-- 根据条件修改若干条记录 --> |
|||
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmIterationProductLink"> |
|||
update XM.xm_iteration_product_link |
|||
<set> |
|||
<include refid="someFieldSet"/> |
|||
</set> |
|||
where iteration_id = #{iterationId} and product_id = #{productId} |
|||
</update> |
|||
|
|||
<!-- 根据主键修改一条记录 --> |
|||
<update id="updateByPk" parameterType="com.xm.core.entity.XmIterationProductLink"> |
|||
update XM.xm_iteration_product_link |
|||
<set> |
|||
<include refid="set"/> |
|||
</set> |
|||
where iteration_id = #{iterationId} and product_id = #{productId} |
|||
</update> |
|||
|
|||
<!-- 批量新增 批量插入 借用insert 循环插入实现 |
|||
<insert id="batchInsert" parameterType="List"> |
|||
</insert> |
|||
--> |
|||
|
|||
<!-- 批量更新 --> |
|||
<update id="batchUpdate" parameterType="List"> |
|||
<foreach collection="list" item="item" index="index" separator=";" > |
|||
update XM.xm_iteration_product_link |
|||
set |
|||
<include refid="batchSet"/> |
|||
where iteration_id = #{item.iterationId} and product_id = #{item.productId} |
|||
</foreach> |
|||
</update> |
|||
<!-- 批量删除 --> |
|||
<delete id="batchDelete" parameterType="List"> |
|||
delete from XM.xm_iteration_product_link |
|||
where |
|||
(iteration_id, product_id) |
|||
in |
|||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
|||
( #{item.iterationId}, #{item.productId} |
|||
) |
|||
</foreach> |
|||
</delete> |
|||
|
|||
|
|||
<!--sql片段 列--> |
|||
<sql id="columns"> |
|||
iteration_id,product_id,ctime,cuserid,cusername,link_status |
|||
</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="productId != null and productId != ''"> and res.product_id = #{productId} </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> |
|||
</sql> |
|||
<!--sql片段 更新字段 --> |
|||
<sql id="set"> |
|||
ctime = #{ctime}, |
|||
cuserid = #{cuserid}, |
|||
cusername = #{cusername}, |
|||
link_status = #{linkStatus} |
|||
</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> |
|||
</sql> |
|||
<!--sql片段 批量更新 --> |
|||
<sql id="batchSet"> |
|||
ctime = #{item.ctime}, |
|||
cuserid = #{item.cuserid}, |
|||
cusername = #{item.cusername}, |
|||
link_status = #{item.linkStatus} |
|||
</sql> |
|||
</mapper> |
|||
@ -0,0 +1,163 @@ |
|||
<?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.XmProductProjectLink"> |
|||
|
|||
|
|||
<!--开始 自定sql函数区域 --> |
|||
<!--请在此区域添加自定义函数--> |
|||
|
|||
|
|||
|
|||
<!--结束 自定义sql函数区域--> |
|||
|
|||
|
|||
|
|||
<!-- 通过条件查询获取数据列表 返回list<map> --> |
|||
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap"> |
|||
select * from XM.xm_product_project_link res |
|||
<where> |
|||
<if test="ids != null"> and |
|||
project_id in |
|||
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
|||
#{item} |
|||
</foreach> |
|||
</if> |
|||
<include refid="where"/> |
|||
<if test="key != null and key !='' "> </if> |
|||
</where> |
|||
</select> |
|||
|
|||
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> --> |
|||
<select id="selectListByWhere" parameterType="com.xm.core.entity.XmProductProjectLink" resultType="com.xm.core.entity.XmProductProjectLink"> |
|||
select * from XM.xm_product_project_link res |
|||
<where> |
|||
<include refid="where"/> |
|||
</where> |
|||
</select> |
|||
|
|||
<!-- 通过主键查询获取数据对象 返回object --> |
|||
<select id="selectOneObject" parameterType="com.xm.core.entity.XmProductProjectLink" resultType="com.xm.core.entity.XmProductProjectLink"> |
|||
select * from XM.xm_product_project_link res |
|||
where |
|||
res.project_id = #{projectId} |
|||
</select> |
|||
|
|||
<!-- 通过主键查询获取数据对象 返回map--> |
|||
<select id="selectOneMap" parameterType="HashMap" resultType="HashMap"> |
|||
select * from XM.xm_product_project_link res |
|||
where |
|||
res.project_id = #{projectId} |
|||
</select> |
|||
<!-- 获取数据条目 返回long --> |
|||
<select id="countByWhere" parameterType="com.xm.core.entity.XmProductProjectLink" resultType="long"> |
|||
select count(1) from XM.xm_product_project_link res |
|||
<where> |
|||
<include refid="where"/> |
|||
</where> |
|||
</select> |
|||
<!-- 新增一条记录 主键project_id,--> |
|||
<insert id="insert" parameterType="com.xm.core.entity.XmProductProjectLink" useGeneratedKeys="false" keyProperty="project_id"> |
|||
insert into XM.xm_product_project_link( |
|||
<include refid="columns"/> |
|||
) values ( |
|||
#{projectId},#{productId},#{ctime},#{cuserid},#{cusername},#{linkStatus} |
|||
) |
|||
</insert> |
|||
|
|||
<!-- 按条件删除若干条记录--> |
|||
<delete id="deleteByWhere" parameterType="com.xm.core.entity.XmProductProjectLink"> |
|||
delete from XM.xm_product_project_link |
|||
<where> |
|||
1=2 |
|||
</where> |
|||
</delete> |
|||
|
|||
<!-- 按主键删除一条记录--> |
|||
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmProductProjectLink"> |
|||
delete from XM.xm_product_project_link |
|||
where project_id = #{projectId} |
|||
</delete> |
|||
|
|||
<!-- 根据条件修改若干条记录 --> |
|||
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmProductProjectLink"> |
|||
update XM.xm_product_project_link |
|||
<set> |
|||
<include refid="someFieldSet"/> |
|||
</set> |
|||
where project_id = #{projectId} |
|||
</update> |
|||
|
|||
<!-- 根据主键修改一条记录 --> |
|||
<update id="updateByPk" parameterType="com.xm.core.entity.XmProductProjectLink"> |
|||
update XM.xm_product_project_link |
|||
<set> |
|||
<include refid="set"/> |
|||
</set> |
|||
where project_id = #{projectId} |
|||
</update> |
|||
|
|||
<!-- 批量新增 批量插入 借用insert 循环插入实现 |
|||
<insert id="batchInsert" parameterType="List"> |
|||
</insert> |
|||
--> |
|||
|
|||
<!-- 批量更新 --> |
|||
<update id="batchUpdate" parameterType="List"> |
|||
<foreach collection="list" item="item" index="index" separator=";" > |
|||
update XM.xm_product_project_link |
|||
set |
|||
<include refid="batchSet"/> |
|||
where project_id = #{item.projectId} |
|||
</foreach> |
|||
</update> |
|||
<!-- 批量删除 --> |
|||
<delete id="batchDelete" parameterType="List"> |
|||
delete from XM.xm_product_project_link |
|||
where |
|||
(project_id) |
|||
in |
|||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
|||
( #{item.projectId} |
|||
) |
|||
</foreach> |
|||
</delete> |
|||
|
|||
|
|||
<!--sql片段 列--> |
|||
<sql id="columns"> |
|||
project_id,product_id,ctime,cuserid,cusername,link_status |
|||
</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="productId != null and productId != ''"> and res.product_id = #{productId} </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> |
|||
</sql> |
|||
<!--sql片段 更新字段 --> |
|||
<sql id="set"> |
|||
product_id = #{productId}, |
|||
ctime = #{ctime}, |
|||
cuserid = #{cuserid}, |
|||
cusername = #{cusername}, |
|||
link_status = #{linkStatus} |
|||
</sql> |
|||
<sql id="someFieldSet"> |
|||
<if test="productId != null and productId != ''"> product_id = #{productId}, </if> |
|||
<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> |
|||
</sql> |
|||
<!--sql片段 批量更新 --> |
|||
<sql id="batchSet"> |
|||
product_id = #{item.productId}, |
|||
ctime = #{item.ctime}, |
|||
cuserid = #{item.cuserid}, |
|||
cusername = #{item.cusername}, |
|||
link_status = #{item.linkStatus} |
|||
</sql> |
|||
</mapper> |
|||
@ -0,0 +1,127 @@ |
|||
package com.xm.core.ctrl; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.*; |
|||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; |
|||
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*; |
|||
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*; |
|||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; |
|||
|
|||
import org.junit.Before; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.mock.web.MockHttpServletRequest; |
|||
import org.springframework.mock.web.MockHttpServletResponse; |
|||
import org.springframework.mock.web.MockHttpSession; |
|||
import org.springframework.mock.web.MockServletContext; |
|||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
|||
import org.springframework.test.context.web.WebAppConfiguration; |
|||
import org.springframework.test.web.servlet.MockMvc; |
|||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; |
|||
import org.springframework.test.web.servlet.setup.MockMvcBuilders; |
|||
import org.springframework.web.context.WebApplicationContext; |
|||
import org.springframework.web.context.request.ServletWebRequest; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import org.springframework.http.MediaType; |
|||
import com.xm.core.entity.XmIterationProductLink; |
|||
import com.mdp.core.utils.BaseUtils; |
|||
/** |
|||
* 组织 com<br> |
|||
* 顶级模块 xm<br> |
|||
* 大模块 core<br> |
|||
* 小模块 <br> |
|||
* 表 XM.xm_iteration_product_link 迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表<br> |
|||
* 实体 XmIterationProductLink<br> |
|||
* 表是指数据库结构中的表,实体是指java类型中的实体类<br> |
|||
* 当前实体所有属性名:<br> |
|||
* iterationId,productId,ctime,cuserid,cusername,linkStatus;<br> |
|||
* 当前表的所有字段名:<br> |
|||
* iteration_id,product_id,ctime,cuserid,cusername,link_status;<br> |
|||
* 当前主键(包括多主键):<br> |
|||
* iteration_id,product_id;<br> |
|||
**/ |
|||
@RunWith(SpringJUnit4ClassRunner.class) |
|||
@SpringBootTest |
|||
public class TestXmIterationProductLinkController { |
|||
|
|||
@Autowired |
|||
public WebApplicationContext wac; // cached |
|||
@Autowired |
|||
public MockServletContext servletContext; // cached |
|||
@Autowired |
|||
public MockHttpSession session; |
|||
@Autowired |
|||
public MockHttpServletRequest request; |
|||
@Autowired |
|||
public MockHttpServletResponse response; |
|||
@Autowired |
|||
public ServletWebRequest webRequest; |
|||
|
|||
public MockMvc mockMvc; |
|||
|
|||
public MockHttpServletRequestBuilder msrb; |
|||
|
|||
ObjectMapper om = new ObjectMapper(); |
|||
|
|||
@Before |
|||
public void setup() { |
|||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); |
|||
} |
|||
|
|||
@Test |
|||
public void add() throws Exception { |
|||
Map<String,Object> p=BaseUtils.map("iterationId","BcN5","productId","7rUG","ctime",new Date("2021-07-17 20:28:11"),"cuserid","UpT2","cusername","y2y7","linkStatus","p"); |
|||
XmIterationProductLink xmIterationProductLink=BaseUtils.fromMap(p,XmIterationProductLink.class); |
|||
String jsonXmIterationProductLink=om.writeValueAsString(xmIterationProductLink); |
|||
mockMvc.perform( post("/**/core/xmIterationProductLink/add").content(jsonXmIterationProductLink).contentType(MediaType.APPLICATION_JSON)) |
|||
.andDo(print()) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(jsonPath("tips.isOk").value(true)); |
|||
} |
|||
|
|||
@Test |
|||
public void list() throws Exception { |
|||
mockMvc.perform( get("/**/core/xmIterationProductLink/list") |
|||
.param("iterationId","BcN5").param("currentPage", "1").param("pageSize", "10")) |
|||
.andDo(print()) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(jsonPath("tips.isOk").value(true)) |
|||
.andExpect(jsonPath("data").isArray()) |
|||
.andExpect(jsonPath("total").exists()); |
|||
} |
|||
|
|||
@Test |
|||
public void edit() throws Exception { |
|||
Map<String,Object> p=BaseUtils.map("iterationId","BcN5","productId","7rUG","ctime",new Date("2021-07-17 20:28:11"),"cuserid","UpT2","cusername","y2y7","linkStatus","p"); |
|||
XmIterationProductLink xmIterationProductLink=BaseUtils.fromMap(p,XmIterationProductLink.class); |
|||
String jsonXmIterationProductLink=om.writeValueAsString(xmIterationProductLink); |
|||
mockMvc.perform( post("/**/core/xmIterationProductLink/edit").content(jsonXmIterationProductLink).contentType(MediaType.APPLICATION_JSON)) |
|||
.andDo(print()) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(jsonPath("tips.isOk").value(true)); |
|||
} |
|||
|
|||
@Test |
|||
public void del() throws Exception { |
|||
mockMvc.perform( post("/**/core/xmIterationProductLink/del").content("BcN5").contentType(MediaType.APPLICATION_JSON)) |
|||
.andDo(print()) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(jsonPath("tips.isOk").value(true)); |
|||
} |
|||
|
|||
@Test |
|||
public void batchDel() throws Exception { |
|||
Map<String,Object> p=BaseUtils.map("iterationId","BcN5","productId","7rUG","ctime",new Date("2021-07-17 20:28:11"),"cuserid","UpT2","cusername","y2y7","linkStatus","p"); |
|||
XmIterationProductLink xmIterationProductLink=BaseUtils.fromMap(p,XmIterationProductLink.class); |
|||
List<XmIterationProductLink> xmIterationProductLinks=new ArrayList<>(); |
|||
xmIterationProductLinks.add(xmIterationProductLink); |
|||
String jsonXmIterationProductLink=om.writeValueAsString(xmIterationProductLinks); |
|||
mockMvc.perform( post("/**/core/xmIterationProductLink/batchDel").content(jsonXmIterationProductLink).contentType(MediaType.APPLICATION_JSON)) |
|||
.andDo(print()) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(jsonPath("tips.isOk").value(true)); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,127 @@ |
|||
package com.xm.core.ctrl; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.*; |
|||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; |
|||
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*; |
|||
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*; |
|||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; |
|||
|
|||
import org.junit.Before; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.mock.web.MockHttpServletRequest; |
|||
import org.springframework.mock.web.MockHttpServletResponse; |
|||
import org.springframework.mock.web.MockHttpSession; |
|||
import org.springframework.mock.web.MockServletContext; |
|||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
|||
import org.springframework.test.context.web.WebAppConfiguration; |
|||
import org.springframework.test.web.servlet.MockMvc; |
|||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; |
|||
import org.springframework.test.web.servlet.setup.MockMvcBuilders; |
|||
import org.springframework.web.context.WebApplicationContext; |
|||
import org.springframework.web.context.request.ServletWebRequest; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import org.springframework.http.MediaType; |
|||
import com.xm.core.entity.XmProductProjectLink; |
|||
import com.mdp.core.utils.BaseUtils; |
|||
/** |
|||
* 组织 com<br> |
|||
* 顶级模块 xm<br> |
|||
* 大模块 core<br> |
|||
* 小模块 <br> |
|||
* 表 XM.xm_product_project_link 产品与项目的关联关系表,一般由产品经理挂接项目到产品上<br> |
|||
* 实体 XmProductProjectLink<br> |
|||
* 表是指数据库结构中的表,实体是指java类型中的实体类<br> |
|||
* 当前实体所有属性名:<br> |
|||
* projectId,productId,ctime,cuserid,cusername,linkStatus;<br> |
|||
* 当前表的所有字段名:<br> |
|||
* project_id,product_id,ctime,cuserid,cusername,link_status;<br> |
|||
* 当前主键(包括多主键):<br> |
|||
* project_id;<br> |
|||
**/ |
|||
@RunWith(SpringJUnit4ClassRunner.class) |
|||
@SpringBootTest |
|||
public class TestXmProductProjectLinkController { |
|||
|
|||
@Autowired |
|||
public WebApplicationContext wac; // cached |
|||
@Autowired |
|||
public MockServletContext servletContext; // cached |
|||
@Autowired |
|||
public MockHttpSession session; |
|||
@Autowired |
|||
public MockHttpServletRequest request; |
|||
@Autowired |
|||
public MockHttpServletResponse response; |
|||
@Autowired |
|||
public ServletWebRequest webRequest; |
|||
|
|||
public MockMvc mockMvc; |
|||
|
|||
public MockHttpServletRequestBuilder msrb; |
|||
|
|||
ObjectMapper om = new ObjectMapper(); |
|||
|
|||
@Before |
|||
public void setup() { |
|||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); |
|||
} |
|||
|
|||
@Test |
|||
public void add() throws Exception { |
|||
Map<String,Object> p=BaseUtils.map("projectId","b1g5","productId","V9Uu","ctime",new Date("2021-07-17 20:28:11"),"cuserid","uw3F","cusername","sPev","linkStatus","1"); |
|||
XmProductProjectLink xmProductProjectLink=BaseUtils.fromMap(p,XmProductProjectLink.class); |
|||
String jsonXmProductProjectLink=om.writeValueAsString(xmProductProjectLink); |
|||
mockMvc.perform( post("/**/core/xmProductProjectLink/add").content(jsonXmProductProjectLink).contentType(MediaType.APPLICATION_JSON)) |
|||
.andDo(print()) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(jsonPath("tips.isOk").value(true)); |
|||
} |
|||
|
|||
@Test |
|||
public void list() throws Exception { |
|||
mockMvc.perform( get("/**/core/xmProductProjectLink/list") |
|||
.param("projectId","b1g5").param("currentPage", "1").param("pageSize", "10")) |
|||
.andDo(print()) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(jsonPath("tips.isOk").value(true)) |
|||
.andExpect(jsonPath("data").isArray()) |
|||
.andExpect(jsonPath("total").exists()); |
|||
} |
|||
|
|||
@Test |
|||
public void edit() throws Exception { |
|||
Map<String,Object> p=BaseUtils.map("projectId","b1g5","productId","V9Uu","ctime",new Date("2021-07-17 20:28:11"),"cuserid","uw3F","cusername","sPev","linkStatus","1"); |
|||
XmProductProjectLink xmProductProjectLink=BaseUtils.fromMap(p,XmProductProjectLink.class); |
|||
String jsonXmProductProjectLink=om.writeValueAsString(xmProductProjectLink); |
|||
mockMvc.perform( post("/**/core/xmProductProjectLink/edit").content(jsonXmProductProjectLink).contentType(MediaType.APPLICATION_JSON)) |
|||
.andDo(print()) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(jsonPath("tips.isOk").value(true)); |
|||
} |
|||
|
|||
@Test |
|||
public void del() throws Exception { |
|||
mockMvc.perform( post("/**/core/xmProductProjectLink/del").content("b1g5").contentType(MediaType.APPLICATION_JSON)) |
|||
.andDo(print()) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(jsonPath("tips.isOk").value(true)); |
|||
} |
|||
|
|||
@Test |
|||
public void batchDel() throws Exception { |
|||
Map<String,Object> p=BaseUtils.map("projectId","b1g5","productId","V9Uu","ctime",new Date("2021-07-17 20:28:11"),"cuserid","uw3F","cusername","sPev","linkStatus","1"); |
|||
XmProductProjectLink xmProductProjectLink=BaseUtils.fromMap(p,XmProductProjectLink.class); |
|||
List<XmProductProjectLink> xmProductProjectLinks=new ArrayList<>(); |
|||
xmProductProjectLinks.add(xmProductProjectLink); |
|||
String jsonXmProductProjectLink=om.writeValueAsString(xmProductProjectLinks); |
|||
mockMvc.perform( post("/**/core/xmProductProjectLink/batchDel").content(jsonXmProductProjectLink).contentType(MediaType.APPLICATION_JSON)) |
|||
.andDo(print()) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(jsonPath("tips.isOk").value(true)); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
package com.xm.core.dao; |
|||
|
|||
import java.util.*; |
|||
import java.text.SimpleDateFormat; |
|||
import org.junit.Assert; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.test.context.ContextConfiguration; |
|||
import org.springframework.test.context.ContextHierarchy; |
|||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
|||
import com.mdp.core.utils.BaseUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import com.mdp.core.dao.BaseDao; |
|||
import com.mdp.mybatis.PageUtils; |
|||
import com.github.pagehelper.Page; |
|||
import com.xm.core.entity.XmIterationProductLink; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
/** |
|||
* XmIterationProductLinkDao的测试案例 |
|||
* 组织 com<br> |
|||
* 顶级模块 xm<br> |
|||
* 大模块 core<br> |
|||
* 小模块 <br> |
|||
* 表 XM.xm_iteration_product_link 迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表<br> |
|||
* 实体 XmIterationProductLink<br> |
|||
* 表是指数据库结构中的表,实体是指java类型中的实体类<br> |
|||
* 当前实体所有属性名:<br> |
|||
* iterationId,productId,ctime,cuserid,cusername,linkStatus;<br> |
|||
* 当前表的所有字段名:<br> |
|||
* iteration_id,product_id,ctime,cuserid,cusername,link_status;<br> |
|||
* 当前主键(包括多主键):<br> |
|||
* iteration_id,product_id;<br> |
|||
***/ |
|||
@RunWith(SpringJUnit4ClassRunner.class) |
|||
@SpringBootTest |
|||
public class TestXmIterationProductLinkDao { |
|||
|
|||
@Autowired |
|||
BaseDao baseDao; |
|||
|
|||
/** |
|||
* 新增一条数据 |
|||
***/ |
|||
@Test |
|||
public void insert() { |
|||
Map<String,Object> p=BaseUtils.map("iterationId","BcN5","productId","7rUG","ctime",new Date("2021-07-17 20:28:11"),"cuserid","UpT2","cusername","y2y7","linkStatus","p"); |
|||
XmIterationProductLink xmIterationProductLink=BaseUtils.fromMap(p,XmIterationProductLink.class); |
|||
baseDao.insert(xmIterationProductLink); |
|||
//Assert.assertEquals(1, result); |
|||
} |
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
package com.xm.core.dao; |
|||
|
|||
import java.util.*; |
|||
import java.text.SimpleDateFormat; |
|||
import org.junit.Assert; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.test.context.ContextConfiguration; |
|||
import org.springframework.test.context.ContextHierarchy; |
|||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
|||
import com.mdp.core.utils.BaseUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import com.mdp.core.dao.BaseDao; |
|||
import com.mdp.mybatis.PageUtils; |
|||
import com.github.pagehelper.Page; |
|||
import com.xm.core.entity.XmProductProjectLink; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
/** |
|||
* XmProductProjectLinkDao的测试案例 |
|||
* 组织 com<br> |
|||
* 顶级模块 xm<br> |
|||
* 大模块 core<br> |
|||
* 小模块 <br> |
|||
* 表 XM.xm_product_project_link 产品与项目的关联关系表,一般由产品经理挂接项目到产品上<br> |
|||
* 实体 XmProductProjectLink<br> |
|||
* 表是指数据库结构中的表,实体是指java类型中的实体类<br> |
|||
* 当前实体所有属性名:<br> |
|||
* projectId,productId,ctime,cuserid,cusername,linkStatus;<br> |
|||
* 当前表的所有字段名:<br> |
|||
* project_id,product_id,ctime,cuserid,cusername,link_status;<br> |
|||
* 当前主键(包括多主键):<br> |
|||
* project_id;<br> |
|||
***/ |
|||
@RunWith(SpringJUnit4ClassRunner.class) |
|||
@SpringBootTest |
|||
public class TestXmProductProjectLinkDao { |
|||
|
|||
@Autowired |
|||
BaseDao baseDao; |
|||
|
|||
/** |
|||
* 新增一条数据 |
|||
***/ |
|||
@Test |
|||
public void insert() { |
|||
Map<String,Object> p=BaseUtils.map("projectId","b1g5","productId","V9Uu","ctime",new Date("2021-07-17 20:28:11"),"cuserid","uw3F","cusername","sPev","linkStatus","1"); |
|||
XmProductProjectLink xmProductProjectLink=BaseUtils.fromMap(p,XmProductProjectLink.class); |
|||
baseDao.insert(xmProductProjectLink); |
|||
//Assert.assertEquals(1, result); |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
package com.xm.core.service; |
|||
|
|||
import java.util.*; |
|||
import java.text.SimpleDateFormat; |
|||
import org.junit.Assert; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.test.context.ContextConfiguration; |
|||
import org.springframework.test.context.ContextHierarchy; |
|||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
|||
import com.mdp.core.utils.BaseUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import com.xm.core.service.XmIterationProductLinkService; |
|||
import com.mdp.mybatis.PageUtils; |
|||
import com.github.pagehelper.Page; |
|||
import com.xm.core.entity.XmIterationProductLink; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
/** |
|||
* XmIterationProductLinkService的测试案例 |
|||
* 组织 com<br> |
|||
* 顶级模块 xm<br> |
|||
* 大模块 core<br> |
|||
* 小模块 <br> |
|||
* 表 XM.xm_iteration_product_link 迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表<br> |
|||
* 实体 XmIterationProductLink<br> |
|||
* 表是指数据库结构中的表,实体是指java类型中的实体类<br> |
|||
* 当前实体所有属性名:<br> |
|||
* iterationId,productId,ctime,cuserid,cusername,linkStatus;<br> |
|||
* 当前表的所有字段名:<br> |
|||
* iteration_id,product_id,ctime,cuserid,cusername,link_status;<br> |
|||
* 当前主键(包括多主键):<br> |
|||
* iteration_id,product_id;<br> |
|||
***/ |
|||
|
|||
@RunWith(SpringJUnit4ClassRunner.class) |
|||
@SpringBootTest |
|||
public class TestXmIterationProductLinkService { |
|||
|
|||
@Autowired |
|||
XmIterationProductLinkService xmIterationProductLinkService; |
|||
|
|||
/** |
|||
* 新增一条数据 |
|||
***/ |
|||
@Test |
|||
public void insert() { |
|||
Map<String,Object> p=BaseUtils.map("iterationId","BcN5","productId","7rUG","ctime",new Date("2021-07-17 20:28:11"),"cuserid","UpT2","cusername","y2y7","linkStatus","p"); |
|||
XmIterationProductLink xmIterationProductLink=BaseUtils.fromMap(p,XmIterationProductLink.class); |
|||
xmIterationProductLinkService.insert(xmIterationProductLink); |
|||
//Assert.assertEquals(1, result); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
package com.xm.core.service; |
|||
|
|||
import java.util.*; |
|||
import java.text.SimpleDateFormat; |
|||
import org.junit.Assert; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.test.context.ContextConfiguration; |
|||
import org.springframework.test.context.ContextHierarchy; |
|||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
|||
import com.mdp.core.utils.BaseUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import com.xm.core.service.XmProductProjectLinkService; |
|||
import com.mdp.mybatis.PageUtils; |
|||
import com.github.pagehelper.Page; |
|||
import com.xm.core.entity.XmProductProjectLink; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
/** |
|||
* XmProductProjectLinkService的测试案例 |
|||
* 组织 com<br> |
|||
* 顶级模块 xm<br> |
|||
* 大模块 core<br> |
|||
* 小模块 <br> |
|||
* 表 XM.xm_product_project_link 产品与项目的关联关系表,一般由产品经理挂接项目到产品上<br> |
|||
* 实体 XmProductProjectLink<br> |
|||
* 表是指数据库结构中的表,实体是指java类型中的实体类<br> |
|||
* 当前实体所有属性名:<br> |
|||
* projectId,productId,ctime,cuserid,cusername,linkStatus;<br> |
|||
* 当前表的所有字段名:<br> |
|||
* project_id,product_id,ctime,cuserid,cusername,link_status;<br> |
|||
* 当前主键(包括多主键):<br> |
|||
* project_id;<br> |
|||
***/ |
|||
|
|||
@RunWith(SpringJUnit4ClassRunner.class) |
|||
@SpringBootTest |
|||
public class TestXmProductProjectLinkService { |
|||
|
|||
@Autowired |
|||
XmProductProjectLinkService xmProductProjectLinkService; |
|||
|
|||
/** |
|||
* 新增一条数据 |
|||
***/ |
|||
@Test |
|||
public void insert() { |
|||
Map<String,Object> p=BaseUtils.map("projectId","b1g5","productId","V9Uu","ctime",new Date("2021-07-17 20:28:11"),"cuserid","uw3F","cusername","sPev","linkStatus","1"); |
|||
XmProductProjectLink xmProductProjectLink=BaseUtils.fromMap(p,XmProductProjectLink.class); |
|||
xmProductProjectLinkService.insert(xmProductProjectLink); |
|||
//Assert.assertEquals(1, result); |
|||
} |
|||
|
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue