Browse Source

分享赚代码

master
陈裕财 5 years ago
parent
commit
39e50e6526
  1. 202
      xm-core/src/main/java/com/xm/share/ctrl/ShareBizInfoController.java
  2. 181
      xm-core/src/main/java/com/xm/share/ctrl/ShareReceInfoController.java
  3. 288
      xm-core/src/main/java/com/xm/share/entity/ShareBizInfo.java
  4. 108
      xm-core/src/main/java/com/xm/share/entity/ShareReceInfo.java
  5. 21
      xm-core/src/main/java/com/xm/share/service/ShareBizInfoService.java
  6. 21
      xm-core/src/main/java/com/xm/share/service/ShareReceInfoService.java
  7. 207
      xm-core/src/main/resources/mybatis/mapper/xm/share/dao/ShareBizInfoMapper.xml
  8. 159
      xm-core/src/main/resources/mybatis/mapper/xm/share/dao/ShareReceInfoMapper.xml
  9. 127
      xm-core/src/test/java/com/xm/share/ctrl/TestShareBizInfoController.java
  10. 127
      xm-core/src/test/java/com/xm/share/ctrl/TestShareReceInfoController.java
  11. 51
      xm-core/src/test/java/com/xm/share/dao/TestShareBizInfoDao.java
  12. 51
      xm-core/src/test/java/com/xm/share/dao/TestShareReceInfoDao.java
  13. 53
      xm-core/src/test/java/com/xm/share/service/TestShareBizInfoService.java
  14. 53
      xm-core/src/test/java/com/xm/share/service/TestShareReceInfoService.java

202
xm-core/src/main/java/com/xm/share/ctrl/ShareBizInfoController.java

@ -0,0 +1,202 @@
package com.xm.share.ctrl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.xm.share.service.ShareReceInfoService;
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.share.service.ShareBizInfoService;
import com.xm.share.entity.ShareBizInfo;
/**
* url编制采用rest风格,如对XM.xm_share_biz_info 分享行为记录表的操作有增删改查,对应的url分别为:<br>
* 新增: share/shareBizInfo/add <br>
* 查询: share/shareBizInfo/list<br>
* 模糊查询: share/shareBizInfo/listKey<br>
* 修改: share/shareBizInfo/edit <br>
* 删除: share/shareBizInfo/del<br>
* 批量删除: share/shareBizInfo/batchDel<br>
* 组织 com 顶级模块 xm 大模块 share 小模块 <br>
* 实体 ShareBizInfo XM.xm_share_biz_info 当前主键(包括多主键): share_key;
***/
@RestController("xm.share.shareBizInfoController")
@RequestMapping(value="/**/share/shareBizInfo")
@Api(tags={"分享行为记录表操作接口"})
public class ShareBizInfoController {
static Logger logger =LoggerFactory.getLogger(ShareBizInfoController.class);
@Autowired
private ShareBizInfoService shareBizInfoService;
@Autowired
private ShareReceInfoService shareReceInfoService;
@ApiOperation( value = "查询分享行为记录表信息列表",notes=" ")
@ApiResponses({
@ApiResponse(code = 200,response=ShareBizInfo.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}")
})
@RequestMapping(value="/list",method=RequestMethod.GET)
public Map<String,Object> listShareBizInfo( @RequestParam Map<String,Object> shareBizInfo){
Map<String,Object> m = new HashMap<>();
RequestUtils.transformArray(shareBizInfo, "shareKeys");
PageUtils.startPage(shareBizInfo);
List<Map<String,Object>> shareBizInfoList = shareBizInfoService.selectListMapByWhere(shareBizInfo); //列出ShareBizInfo列表
PageUtils.responePage(m, shareBizInfoList);
m.put("data",shareBizInfoList);
Tips tips=new Tips("查询成功");
m.put("tips", tips);
return m;
}
/***/
@ApiOperation( value = "新增一条分享行为记录表信息",notes=" ")
@ApiResponses({
@ApiResponse(code = 200,response=ShareBizInfo.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}")
})
@RequestMapping(value="/add",method=RequestMethod.POST)
public Map<String,Object> addShareBizInfo(@RequestBody ShareBizInfo shareBizInfo) {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功新增一条数据");
try{
shareBizInfo.setShareKey(shareBizInfoService.createKey("shareKey"));
//todo 检查是否已经分享过 通过biz_pk_id+share_userid进行判断
ShareBizInfo queryBizInfo=new ShareBizInfo();
queryBizInfo.setBizPkId(shareBizInfo.getBizPkId());
queryBizInfo.setBizType(shareBizInfo.getBizType());
queryBizInfo.setBizSubPkId(shareBizInfo.getBizSubPkId());
queryBizInfo.setShareUserid(shareBizInfo.getShareUserid());
List<ShareBizInfo> myShareBizInfos=shareBizInfoService.selectListByWhere(queryBizInfo);
if(myShareBizInfos!=null && myShareBizInfos.size()>0){
tips.setOkMsg("分享成功");
m.put("tips", tips);
m.put("data",myShareBizInfos.get(0));
return m;
}
//todo 检查我是否接受的别人的分享的第二次分享 通过biz_pk_id+share_userid判断
ShareBizInfo queryBizInfo2=new ShareBizInfo();
queryBizInfo2.setBizPkId(shareBizInfo.getBizPkId());
queryBizInfo2.setBizType(shareBizInfo.getBizType());
queryBizInfo2.setBizSubPkId(shareBizInfo.getBizSubPkId());
queryBizInfo2.setShareUserid(shareBizInfo.getShareUserid());
List<ShareBizInfo> myParentShareBizInfos=shareBizInfoService.selectList("selectMyParentShareBizInfo",queryBizInfo2);
if(myParentShareBizInfos!=null && myParentShareBizInfos.size()>0){
ShareBizInfo myParentShareBizInfoDb=myParentShareBizInfos.get(0);
shareBizInfo.setPshareKey(myParentShareBizInfoDb.getShareKey());
shareBizInfo.setPshareUserid(myParentShareBizInfoDb.getShareUserid());
shareBizInfo.setPshareUsername(myParentShareBizInfoDb.getShareUsername());
}
shareBizInfoService.insert(shareBizInfo);
m.put("data",shareBizInfo);
}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> delShareBizInfo(@RequestBody ShareBizInfo shareBizInfo){
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功删除一条数据");
try{
shareBizInfoService.deleteByPk(shareBizInfo);
}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=ShareBizInfo.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}")
})
@RequestMapping(value="/edit",method=RequestMethod.POST)
public Map<String,Object> editShareBizInfo(@RequestBody ShareBizInfo shareBizInfo) {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功更新一条数据");
try{
shareBizInfoService.updateByPk(shareBizInfo);
m.put("data",shareBizInfo);
}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> batchDelShareBizInfo(@RequestBody List<ShareBizInfo> shareBizInfos) {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功删除"+shareBizInfos.size()+"条数据");
try{
shareBizInfoService.batchDelete(shareBizInfos);
}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;
}
*/
}

181
xm-core/src/main/java/com/xm/share/ctrl/ShareReceInfoController.java

@ -0,0 +1,181 @@
package com.xm.share.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.share.service.ShareReceInfoService;
import com.xm.share.entity.ShareReceInfo;
/**
* url编制采用rest风格,如对XM.xm_share_rece_info 分享后接收人行为记录表的操作有增删改查,对应的url分别为:<br>
* 新增: share/shareReceInfo/add <br>
* 查询: share/shareReceInfo/list<br>
* 模糊查询: share/shareReceInfo/listKey<br>
* 修改: share/shareReceInfo/edit <br>
* 删除: share/shareReceInfo/del<br>
* 批量删除: share/shareReceInfo/batchDel<br>
* 组织 com 顶级模块 xm 大模块 share 小模块 <br>
* 实体 ShareReceInfo XM.xm_share_rece_info 当前主键(包括多主键): id;
***/
@RestController("xm.share.shareReceInfoController")
@RequestMapping(value="/**/share/shareReceInfo")
@Api(tags={"分享后接收人行为记录表操作接口"})
public class ShareReceInfoController {
static Logger logger =LoggerFactory.getLogger(ShareReceInfoController.class);
@Autowired
private ShareReceInfoService shareReceInfoService;
@ApiOperation( value = "查询分享后接收人行为记录表信息列表",notes=" ")
@ApiResponses({
@ApiResponse(code = 200,response=ShareReceInfo.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}")
})
@RequestMapping(value="/list",method=RequestMethod.GET)
public Map<String,Object> listShareReceInfo( @RequestParam Map<String,Object> shareReceInfo){
Map<String,Object> m = new HashMap<>();
RequestUtils.transformArray(shareReceInfo, "ids");
PageUtils.startPage(shareReceInfo);
List<Map<String,Object>> shareReceInfoList = shareReceInfoService.selectListMapByWhere(shareReceInfo); //列出ShareReceInfo列表
PageUtils.responePage(m, shareReceInfoList);
m.put("data",shareReceInfoList);
Tips tips=new Tips("查询成功");
m.put("tips", tips);
return m;
}
/**
*/
@ApiOperation( value = "新增一条分享后接收人行为记录表信息",notes=" ")
@ApiResponses({
@ApiResponse(code = 200,response=ShareReceInfo.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}")
})
@RequestMapping(value="/add",method=RequestMethod.POST)
public Map<String,Object> addShareReceInfo(@RequestBody ShareReceInfo shareReceInfo) {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功新增一条数据");
try{
shareReceInfo.setId(shareReceInfoService.createKey("id"));
ShareReceInfo query=new ShareReceInfo();
query.setShareKey(shareReceInfo.getShareKey());
query.setReceiverId(shareReceInfo.getReceiverId());
List<ShareReceInfo> myShareReceInfos=this.shareReceInfoService.selectListByWhere(query);
if(myShareReceInfos!=null && myShareReceInfos.size()>0){
tips.setOkMsg("成功");
m.put("tips", tips);
}
shareReceInfoService.insert(shareReceInfo);
m.put("data",shareReceInfo);
}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> delShareReceInfo(@RequestBody ShareReceInfo shareReceInfo){
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功删除一条数据");
try{
shareReceInfoService.deleteByPk(shareReceInfo);
}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=ShareReceInfo.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}")
})
@RequestMapping(value="/edit",method=RequestMethod.POST)
public Map<String,Object> editShareReceInfo(@RequestBody ShareReceInfo shareReceInfo) {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功更新一条数据");
try{
shareReceInfoService.updateByPk(shareReceInfo);
m.put("data",shareReceInfo);
}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> batchDelShareReceInfo(@RequestBody List<ShareReceInfo> shareReceInfos) {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功删除"+shareReceInfos.size()+"条数据");
try{
shareReceInfoService.batchDelete(shareReceInfos);
}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;
}
*/
}

288
xm-core/src/main/java/com/xm/share/entity/ShareBizInfo.java

@ -0,0 +1,288 @@
package com.xm.share.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* 组织 com 顶级模块 xm 大模块 share 小模块 <br>
* 实体 ShareBizInfo所有属性名: <br>
* shareKey,shareUserid,shareUsername,pageUrl,pageType,shareTime,bizPkId,bizBranchId,shareBranchId,bizSubPkId,params,shareType,pshareKey,pshareUserid,pshareUsername,bizType,bizCategoryId;<br>
* XM.xm_share_biz_info 分享行为记录表的所有字段名: <br>
* share_key,share_userid,share_username,page_url,page_type,share_time,biz_pk_id,biz_branch_id,share_branch_id,biz_sub_pk_id,params,share_type,pshare_key,pshare_userid,pshare_username,biz_type,biz_category_id;<br>
* 当前主键(包括多主键):<br>
* share_key;<br>
*/
@ApiModel(description="分享行为记录表")
public class ShareBizInfo implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes="分享编号,一次分享行为一个shareKey,分享链接之间前端传递;,主键",allowEmptyValue=true,example="",allowableValues="")
String shareKey;
@ApiModelProperty(notes="分享人编号",allowEmptyValue=true,example="",allowableValues="")
String shareUserid;
@ApiModelProperty(notes="分享人姓名",allowEmptyValue=true,example="",allowableValues="")
String shareUsername;
@ApiModelProperty(notes="分享地址",allowEmptyValue=true,example="",allowableValues="")
String pageUrl;
@ApiModelProperty(notes="分享地址类型0-h5,1-微信小程序,2-微信公众号,3-app页面",allowEmptyValue=true,example="",allowableValues="")
String pageType;
@ApiModelProperty(notes="分享时间",allowEmptyValue=true,example="",allowableValues="")
Date shareTime;
@ApiModelProperty(notes="分享的业务对应的主键",allowEmptyValue=true,example="",allowableValues="")
String bizPkId;
@ApiModelProperty(notes="分享的业务所属机构号",allowEmptyValue=true,example="",allowableValues="")
String bizBranchId;
@ApiModelProperty(notes="分享人所属机构号",allowEmptyValue=true,example="",allowableValues="")
String shareBranchId;
@ApiModelProperty(notes="分享的业务对应的子主键(复合主键下使用)",allowEmptyValue=true,example="",allowableValues="")
String bizSubPkId;
@ApiModelProperty(notes="分享参数,需要特殊扩展时使用",allowEmptyValue=true,example="",allowableValues="")
String params;
@ApiModelProperty(notes="分享业务类型",allowEmptyValue=true,example="",allowableValues="")
String shareType;
@ApiModelProperty(notes="上级分享码,冗余字段,方便计算",allowEmptyValue=true,example="",allowableValues="")
String pshareKey;
@ApiModelProperty(notes="上级分享人编号,冗余字段,方便计算",allowEmptyValue=true,example="",allowableValues="")
String pshareUserid;
@ApiModelProperty(notes="上级分享人姓名,冗余字段,方便计算",allowEmptyValue=true,example="",allowableValues="")
String pshareUsername;
@ApiModelProperty(notes="业务分类0商品1项目2任务3故事4app",allowEmptyValue=true,example="",allowableValues="")
String bizType;
@ApiModelProperty(notes="业务分类的主键,用于与分佣方案比对,分佣方案是可以针对一类商品进行分佣,可以对于具体的商品进行分佣",allowEmptyValue=true,example="",allowableValues="")
String bizCategoryId;
/**分享编号,一次分享行为一个shareKey,分享链接之间前端传递;**/
public ShareBizInfo(String shareKey) {
this.shareKey = shareKey;
}
/**分享行为记录表**/
public ShareBizInfo() {
}
/**
* 分享编号一次分享行为一个shareKey,分享链接之间前端传递
**/
public void setShareKey(String shareKey) {
this.shareKey = shareKey;
}
/**
* 分享人编号
**/
public void setShareUserid(String shareUserid) {
this.shareUserid = shareUserid;
}
/**
* 分享人姓名
**/
public void setShareUsername(String shareUsername) {
this.shareUsername = shareUsername;
}
/**
* 分享地址
**/
public void setPageUrl(String pageUrl) {
this.pageUrl = pageUrl;
}
/**
* 分享地址类型0-h5,1-微信小程序,2-微信公众号,3-app页面
**/
public void setPageType(String pageType) {
this.pageType = pageType;
}
/**
* 分享时间
**/
public void setShareTime(Date shareTime) {
this.shareTime = shareTime;
}
/**
* 分享的业务对应的主键
**/
public void setBizPkId(String bizPkId) {
this.bizPkId = bizPkId;
}
/**
* 分享的业务所属机构号
**/
public void setBizBranchId(String bizBranchId) {
this.bizBranchId = bizBranchId;
}
/**
* 分享人所属机构号
**/
public void setShareBranchId(String shareBranchId) {
this.shareBranchId = shareBranchId;
}
/**
* 分享的业务对应的子主键复合主键下使用
**/
public void setBizSubPkId(String bizSubPkId) {
this.bizSubPkId = bizSubPkId;
}
/**
* 分享参数需要特殊扩展时使用
**/
public void setParams(String params) {
this.params = params;
}
/**
* 分享业务类型
**/
public void setShareType(String shareType) {
this.shareType = shareType;
}
/**
* 上级分享码冗余字段方便计算
**/
public void setPshareKey(String pshareKey) {
this.pshareKey = pshareKey;
}
/**
* 上级分享人编号冗余字段方便计算
**/
public void setPshareUserid(String pshareUserid) {
this.pshareUserid = pshareUserid;
}
/**
* 上级分享人姓名冗余字段方便计算
**/
public void setPshareUsername(String pshareUsername) {
this.pshareUsername = pshareUsername;
}
/**
* 业务分类0商品1项目2任务3故事4app
**/
public void setBizType(String bizType) {
this.bizType = bizType;
}
/**
* 业务分类的主键用于与分佣方案比对分佣方案是可以针对一类商品进行分佣可以对于具体的商品进行分佣
**/
public void setBizCategoryId(String bizCategoryId) {
this.bizCategoryId = bizCategoryId;
}
/**
* 分享编号一次分享行为一个shareKey,分享链接之间前端传递
**/
public String getShareKey() {
return this.shareKey;
}
/**
* 分享人编号
**/
public String getShareUserid() {
return this.shareUserid;
}
/**
* 分享人姓名
**/
public String getShareUsername() {
return this.shareUsername;
}
/**
* 分享地址
**/
public String getPageUrl() {
return this.pageUrl;
}
/**
* 分享地址类型0-h5,1-微信小程序,2-微信公众号,3-app页面
**/
public String getPageType() {
return this.pageType;
}
/**
* 分享时间
**/
public Date getShareTime() {
return this.shareTime;
}
/**
* 分享的业务对应的主键
**/
public String getBizPkId() {
return this.bizPkId;
}
/**
* 分享的业务所属机构号
**/
public String getBizBranchId() {
return this.bizBranchId;
}
/**
* 分享人所属机构号
**/
public String getShareBranchId() {
return this.shareBranchId;
}
/**
* 分享的业务对应的子主键复合主键下使用
**/
public String getBizSubPkId() {
return this.bizSubPkId;
}
/**
* 分享参数需要特殊扩展时使用
**/
public String getParams() {
return this.params;
}
/**
* 分享业务类型
**/
public String getShareType() {
return this.shareType;
}
/**
* 上级分享码冗余字段方便计算
**/
public String getPshareKey() {
return this.pshareKey;
}
/**
* 上级分享人编号冗余字段方便计算
**/
public String getPshareUserid() {
return this.pshareUserid;
}
/**
* 上级分享人姓名冗余字段方便计算
**/
public String getPshareUsername() {
return this.pshareUsername;
}
/**
* 业务分类0商品1项目2任务3故事4app
**/
public String getBizType() {
return this.bizType;
}
/**
* 业务分类的主键用于与分佣方案比对分佣方案是可以针对一类商品进行分佣可以对于具体的商品进行分佣
**/
public String getBizCategoryId() {
return this.bizCategoryId;
}
}

108
xm-core/src/main/java/com/xm/share/entity/ShareReceInfo.java

@ -0,0 +1,108 @@
package com.xm.share.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* 组织 com 顶级模块 xm 大模块 share 小模块 <br>
* 实体 ShareReceInfo所有属性名: <br>
* id,shareKey,receiverId,receiverName,receTime;<br>
* XM.xm_share_rece_info 分享后接收人行为记录表的所有字段名: <br>
* id,share_key,receiver_id,receiver_name,rece_time;<br>
* 当前主键(包括多主键):<br>
* id;<br>
*/
@ApiModel(description="分享后接收人行为记录表")
public class ShareReceInfo implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes="主键,主键",allowEmptyValue=true,example="",allowableValues="")
String id;
@ApiModelProperty(notes="分享编号,分享链接之间前端传递",allowEmptyValue=true,example="",allowableValues="")
String shareKey;
@ApiModelProperty(notes="接收人编号",allowEmptyValue=true,example="",allowableValues="")
String receiverId;
@ApiModelProperty(notes="接收入姓名",allowEmptyValue=true,example="",allowableValues="")
String receiverName;
@ApiModelProperty(notes="接收时间",allowEmptyValue=true,example="",allowableValues="")
Date receTime;
/**主键**/
public ShareReceInfo(String id) {
this.id = id;
}
/**分享后接收人行为记录表**/
public ShareReceInfo() {
}
/**
* 主键
**/
public void setId(String id) {
this.id = id;
}
/**
* 分享编号分享链接之间前端传递
**/
public void setShareKey(String shareKey) {
this.shareKey = shareKey;
}
/**
* 接收人编号
**/
public void setReceiverId(String receiverId) {
this.receiverId = receiverId;
}
/**
* 接收入姓名
**/
public void setReceiverName(String receiverName) {
this.receiverName = receiverName;
}
/**
* 接收时间
**/
public void setReceTime(Date receTime) {
this.receTime = receTime;
}
/**
* 主键
**/
public String getId() {
return this.id;
}
/**
* 分享编号分享链接之间前端传递
**/
public String getShareKey() {
return this.shareKey;
}
/**
* 接收人编号
**/
public String getReceiverId() {
return this.receiverId;
}
/**
* 接收入姓名
**/
public String getReceiverName() {
return this.receiverName;
}
/**
* 接收时间
**/
public Date getReceTime() {
return this.receTime;
}
}

21
xm-core/src/main/java/com/xm/share/service/ShareBizInfoService.java

@ -0,0 +1,21 @@
package com.xm.share.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.share.entity.ShareBizInfo;
/**
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br>
* 组织 com 顶级模块 xm 大模块 share 小模块 <br>
* 实体 ShareBizInfo XM.xm_share_biz_info 当前主键(包括多主键): share_key;
***/
@Service("xm.share.shareBizInfoService")
public class ShareBizInfoService extends BaseService {
static Logger logger =LoggerFactory.getLogger(ShareBizInfoService.class);
/** 请在此类添加自定义函数 */
}

21
xm-core/src/main/java/com/xm/share/service/ShareReceInfoService.java

@ -0,0 +1,21 @@
package com.xm.share.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.share.entity.ShareReceInfo;
/**
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br>
* 组织 com 顶级模块 xm 大模块 share 小模块 <br>
* 实体 ShareReceInfo XM.xm_share_rece_info 当前主键(包括多主键): id;
***/
@Service("xm.share.shareReceInfoService")
public class ShareReceInfoService extends BaseService {
static Logger logger =LoggerFactory.getLogger(ShareReceInfoService.class);
/** 请在此类添加自定义函数 */
}

207
xm-core/src/main/resources/mybatis/mapper/xm/share/dao/ShareBizInfoMapper.xml

@ -0,0 +1,207 @@
<?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.share.entity.ShareBizInfo">
<!--开始 自定sql函数区域 -->
<!--请在此区域添加自定义函数-->
<!--结束 自定义sql函数区域-->
<!-- 通过条件查询获取数据列表 返回list<map> -->
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap">
select * from XM.xm_share_biz_info res
<where>
<if test="ids != null"> and
share_key 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.share.entity.ShareBizInfo" resultType="com.xm.share.entity.ShareBizInfo">
select * from XM.xm_share_biz_info res
<where>
<include refid="where"/>
</where>
</select>
<!-- 通过主键查询获取数据对象 返回object -->
<select id="selectOneObject" parameterType="com.xm.share.entity.ShareBizInfo" resultType="com.xm.share.entity.ShareBizInfo">
select * from XM.xm_share_biz_info res
where
res.share_key = #{shareKey}
</select>
<!-- 通过主键查询获取数据对象 返回map-->
<select id="selectOneMap" parameterType="HashMap" resultType="HashMap">
select * from XM.xm_share_biz_info res
where
res.share_key = #{shareKey}
</select>
<!-- 获取数据条目 返回long -->
<select id="countByWhere" parameterType="com.xm.share.entity.ShareBizInfo" resultType="long">
select count(1) from XM.xm_share_biz_info res
<where>
<include refid="where"/>
</where>
</select>
<!-- 新增一条记录 主键share_key,-->
<insert id="insert" parameterType="com.xm.share.entity.ShareBizInfo" useGeneratedKeys="false" keyProperty="share_key">
insert into XM.xm_share_biz_info(
<include refid="columns"/>
) values (
#{shareKey},#{shareUserid},#{shareUsername},#{pageUrl},#{pageType},#{shareTime},#{bizPkId},#{bizBranchId},#{shareBranchId},#{bizSubPkId},#{params},#{shareType},#{pshareKey},#{pshareUserid},#{pshareUsername},#{bizType},#{bizCategoryId}
)
</insert>
<!-- 按条件删除若干条记录-->
<delete id="deleteByWhere" parameterType="com.xm.share.entity.ShareBizInfo">
delete from XM.xm_share_biz_info
<where>
1=2
</where>
</delete>
<!-- 按主键删除一条记录-->
<delete id="deleteByPk" parameterType="com.xm.share.entity.ShareBizInfo">
delete from XM.xm_share_biz_info
where share_key = #{shareKey}
</delete>
<!-- 根据条件修改若干条记录 -->
<update id="updateSomeFieldByPk" parameterType="com.xm.share.entity.ShareBizInfo">
update XM.xm_share_biz_info
<set>
<include refid="someFieldSet"/>
</set>
where share_key = #{shareKey}
</update>
<!-- 根据主键修改一条记录 -->
<update id="updateByPk" parameterType="com.xm.share.entity.ShareBizInfo">
update XM.xm_share_biz_info
<set>
<include refid="set"/>
</set>
where share_key = #{shareKey}
</update>
<!-- 批量新增 批量插入 借用insert 循环插入实现
<insert id="batchInsert" parameterType="List">
</insert>
-->
<!-- 批量更新 -->
<update id="batchUpdate" parameterType="List">
<foreach collection="list" item="item" index="index" separator=";" >
update XM.xm_share_biz_info
set
<include refid="batchSet"/>
where share_key = #{item.shareKey}
</foreach>
</update>
<!-- 批量删除 -->
<delete id="batchDelete" parameterType="List">
delete from XM.xm_share_biz_info
where
(share_key)
in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" >
( #{item.shareKey}
)
</foreach>
</delete>
<!--sql片段 列-->
<sql id="columns">
share_key,share_userid,share_username,page_url,page_type,share_time,biz_pk_id,biz_branch_id,share_branch_id,biz_sub_pk_id,params,share_type,pshare_key,pshare_userid,pshare_username,biz_type,biz_category_id
</sql>
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS-->
<sql id="where">
<if test="shareKey != null and shareKey != ''"> and res.share_key = #{shareKey} </if>
<if test="shareUserid != null and shareUserid != ''"> and res.share_userid = #{shareUserid} </if>
<if test="shareUsername != null and shareUsername != ''"> and res.share_username = #{shareUsername} </if>
<if test="pageUrl != null and pageUrl != ''"> and res.page_url = #{pageUrl} </if>
<if test="pageType != null and pageType != ''"> and res.page_type = #{pageType} </if>
<if test="shareTime != null"> and date_format(res.share_time,'%Y-%m-%d') = date_format(#{shareTime},'%Y-%m-%d') </if>
<if test="bizPkId != null and bizPkId != ''"> and res.biz_pk_id = #{bizPkId} </if>
<if test="bizBranchId != null and bizBranchId != ''"> and res.biz_branch_id = #{bizBranchId} </if>
<if test="shareBranchId != null and shareBranchId != ''"> and res.share_branch_id = #{shareBranchId} </if>
<if test="bizSubPkId != null and bizSubPkId != ''"> and res.biz_sub_pk_id = #{bizSubPkId} </if>
<if test="params != null and params != ''"> and res.params = #{params} </if>
<if test="shareType != null and shareType != ''"> and res.share_type = #{shareType} </if>
<if test="pshareKey != null and pshareKey != ''"> and res.pshare_key = #{pshareKey} </if>
<if test="pshareUserid != null and pshareUserid != ''"> and res.pshare_userid = #{pshareUserid} </if>
<if test="pshareUsername != null and pshareUsername != ''"> and res.pshare_username = #{pshareUsername} </if>
<if test="bizType != null and bizType != ''"> and res.biz_type = #{bizType} </if>
<if test="bizCategoryId != null and bizCategoryId != ''"> and res.biz_category_id = #{bizCategoryId} </if>
</sql>
<!--sql片段 更新字段 -->
<sql id="set">
share_userid = #{shareUserid},
share_username = #{shareUsername},
page_url = #{pageUrl},
page_type = #{pageType},
share_time = #{shareTime},
biz_pk_id = #{bizPkId},
biz_branch_id = #{bizBranchId},
share_branch_id = #{shareBranchId},
biz_sub_pk_id = #{bizSubPkId},
params = #{params},
share_type = #{shareType},
pshare_key = #{pshareKey},
pshare_userid = #{pshareUserid},
pshare_username = #{pshareUsername},
biz_type = #{bizType},
biz_category_id = #{bizCategoryId}
</sql>
<sql id="someFieldSet">
<if test="shareUserid != null and shareUserid != ''"> share_userid = #{shareUserid}, </if>
<if test="shareUsername != null and shareUsername != ''"> share_username = #{shareUsername}, </if>
<if test="pageUrl != null and pageUrl != ''"> page_url = #{pageUrl}, </if>
<if test="pageType != null and pageType != ''"> page_type = #{pageType}, </if>
<if test="shareTime != null"> share_time = #{shareTime}, </if>
<if test="bizPkId != null and bizPkId != ''"> biz_pk_id = #{bizPkId}, </if>
<if test="bizBranchId != null and bizBranchId != ''"> biz_branch_id = #{bizBranchId}, </if>
<if test="shareBranchId != null and shareBranchId != ''"> share_branch_id = #{shareBranchId}, </if>
<if test="bizSubPkId != null and bizSubPkId != ''"> biz_sub_pk_id = #{bizSubPkId}, </if>
<if test="params != null and params != ''"> params = #{params}, </if>
<if test="shareType != null and shareType != ''"> share_type = #{shareType}, </if>
<if test="pshareKey != null and pshareKey != ''"> pshare_key = #{pshareKey}, </if>
<if test="pshareUserid != null and pshareUserid != ''"> pshare_userid = #{pshareUserid}, </if>
<if test="pshareUsername != null and pshareUsername != ''"> pshare_username = #{pshareUsername}, </if>
<if test="bizType != null and bizType != ''"> biz_type = #{bizType}, </if>
<if test="bizCategoryId != null and bizCategoryId != ''"> biz_category_id = #{bizCategoryId}, </if>
</sql>
<!--sql片段 批量更新 -->
<sql id="batchSet">
share_userid = #{item.shareUserid},
share_username = #{item.shareUsername},
page_url = #{item.pageUrl},
page_type = #{item.pageType},
share_time = #{item.shareTime},
biz_pk_id = #{item.bizPkId},
biz_branch_id = #{item.bizBranchId},
share_branch_id = #{item.shareBranchId},
biz_sub_pk_id = #{item.bizSubPkId},
params = #{item.params},
share_type = #{item.shareType},
pshare_key = #{item.pshareKey},
pshare_userid = #{item.pshareUserid},
pshare_username = #{item.pshareUsername},
biz_type = #{item.bizType},
biz_category_id = #{item.bizCategoryId}
</sql>
</mapper>

159
xm-core/src/main/resources/mybatis/mapper/xm/share/dao/ShareReceInfoMapper.xml

@ -0,0 +1,159 @@
<?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.share.entity.ShareReceInfo">
<!--开始 自定sql函数区域 -->
<!--请在此区域添加自定义函数-->
<!--结束 自定义sql函数区域-->
<!-- 通过条件查询获取数据列表 返回list<map> -->
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap">
select * from XM.xm_share_rece_info res
<where>
<if test="ids != null"> and
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.share.entity.ShareReceInfo" resultType="com.xm.share.entity.ShareReceInfo">
select * from XM.xm_share_rece_info res
<where>
<include refid="where"/>
</where>
</select>
<!-- 通过主键查询获取数据对象 返回object -->
<select id="selectOneObject" parameterType="com.xm.share.entity.ShareReceInfo" resultType="com.xm.share.entity.ShareReceInfo">
select * from XM.xm_share_rece_info res
where
res.id = #{id}
</select>
<!-- 通过主键查询获取数据对象 返回map-->
<select id="selectOneMap" parameterType="HashMap" resultType="HashMap">
select * from XM.xm_share_rece_info res
where
res.id = #{id}
</select>
<!-- 获取数据条目 返回long -->
<select id="countByWhere" parameterType="com.xm.share.entity.ShareReceInfo" resultType="long">
select count(1) from XM.xm_share_rece_info res
<where>
<include refid="where"/>
</where>
</select>
<!-- 新增一条记录 主键id,-->
<insert id="insert" parameterType="com.xm.share.entity.ShareReceInfo" useGeneratedKeys="false" keyProperty="id">
insert into XM.xm_share_rece_info(
<include refid="columns"/>
) values (
#{id},#{shareKey},#{receiverId},#{receiverName},#{receTime}
)
</insert>
<!-- 按条件删除若干条记录-->
<delete id="deleteByWhere" parameterType="com.xm.share.entity.ShareReceInfo">
delete from XM.xm_share_rece_info
<where>
1=2
</where>
</delete>
<!-- 按主键删除一条记录-->
<delete id="deleteByPk" parameterType="com.xm.share.entity.ShareReceInfo">
delete from XM.xm_share_rece_info
where id = #{id}
</delete>
<!-- 根据条件修改若干条记录 -->
<update id="updateSomeFieldByPk" parameterType="com.xm.share.entity.ShareReceInfo">
update XM.xm_share_rece_info
<set>
<include refid="someFieldSet"/>
</set>
where id = #{id}
</update>
<!-- 根据主键修改一条记录 -->
<update id="updateByPk" parameterType="com.xm.share.entity.ShareReceInfo">
update XM.xm_share_rece_info
<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.xm_share_rece_info
set
<include refid="batchSet"/>
where id = #{item.id}
</foreach>
</update>
<!-- 批量删除 -->
<delete id="batchDelete" parameterType="List">
delete from XM.xm_share_rece_info
where
(id)
in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" >
( #{item.id}
)
</foreach>
</delete>
<!--sql片段 列-->
<sql id="columns">
id,share_key,receiver_id,receiver_name,rece_time
</sql>
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS-->
<sql id="where">
<if test="id != null and id != ''"> and res.id = #{id} </if>
<if test="shareKey != null and shareKey != ''"> and res.share_key = #{shareKey} </if>
<if test="receiverId != null and receiverId != ''"> and res.receiver_id = #{receiverId} </if>
<if test="receiverName != null and receiverName != ''"> and res.receiver_name = #{receiverName} </if>
<if test="receTime != null"> and date_format(res.rece_time,'%Y-%m-%d') = date_format(#{receTime},'%Y-%m-%d') </if>
</sql>
<!--sql片段 更新字段 -->
<sql id="set">
share_key = #{shareKey},
receiver_id = #{receiverId},
receiver_name = #{receiverName},
rece_time = #{receTime}
</sql>
<sql id="someFieldSet">
<if test="shareKey != null and shareKey != ''"> share_key = #{shareKey}, </if>
<if test="receiverId != null and receiverId != ''"> receiver_id = #{receiverId}, </if>
<if test="receiverName != null and receiverName != ''"> receiver_name = #{receiverName}, </if>
<if test="receTime != null"> rece_time = #{receTime}, </if>
</sql>
<!--sql片段 批量更新 -->
<sql id="batchSet">
share_key = #{item.shareKey},
receiver_id = #{item.receiverId},
receiver_name = #{item.receiverName},
rece_time = #{item.receTime}
</sql>
</mapper>

127
xm-core/src/test/java/com/xm/share/ctrl/TestShareBizInfoController.java

@ -0,0 +1,127 @@
package com.xm.share.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.share.entity.ShareBizInfo;
import com.mdp.core.utils.BaseUtils;
/**
* 组织 com<br>
* 顶级模块 xm<br>
* 大模块 share<br>
* 小模块 <br>
* XM.xm_share_biz_info 分享行为记录表<br>
* 实体 ShareBizInfo<br>
* 表是指数据库结构中的表,实体是指java类型中的实体类<br>
* 当前实体所有属性名:<br>
* shareKey,shareUserid,shareUsername,pageUrl,pageType,shareTime,bizPkId,bizBranchId,shareBranchId,bizSubPkId,params,shareType,pshareKey,pshareUserid,pshareUsername,bizType,bizCategoryId;<br>
* 当前表的所有字段名:<br>
* share_key,share_userid,share_username,page_url,page_type,share_time,biz_pk_id,biz_branch_id,share_branch_id,biz_sub_pk_id,params,share_type,pshare_key,pshare_userid,pshare_username,biz_type,biz_category_id;<br>
* 当前主键(包括多主键):<br>
* share_key;<br>
**/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class TestShareBizInfoController {
@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("shareKey","9303","shareUserid","zZoc","shareUsername","V9tr","pageUrl","wBF3","pageType","ylHj","shareTime",new Date("2021-04-22 17:12:53"),"bizPkId","c6DC","bizBranchId","5HjB","shareBranchId","0aSc","bizSubPkId","5ps3","params","b175","shareType","q0Jh","pshareKey","it9W","pshareUserid","IaYJ","pshareUsername","GGIz","bizType","9Uqr","bizCategoryId","FL8C");
ShareBizInfo shareBizInfo=BaseUtils.fromMap(p,ShareBizInfo.class);
String jsonShareBizInfo=om.writeValueAsString(shareBizInfo);
mockMvc.perform( post("/**/share/shareBizInfo/add").content(jsonShareBizInfo).contentType(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("tips.isOk").value(true));
}
@Test
public void list() throws Exception {
mockMvc.perform( get("/**/share/shareBizInfo/list")
.param("shareKey","9303").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("shareKey","9303","shareUserid","zZoc","shareUsername","V9tr","pageUrl","wBF3","pageType","ylHj","shareTime",new Date("2021-04-22 17:12:53"),"bizPkId","c6DC","bizBranchId","5HjB","shareBranchId","0aSc","bizSubPkId","5ps3","params","b175","shareType","q0Jh","pshareKey","it9W","pshareUserid","IaYJ","pshareUsername","GGIz","bizType","9Uqr","bizCategoryId","FL8C");
ShareBizInfo shareBizInfo=BaseUtils.fromMap(p,ShareBizInfo.class);
String jsonShareBizInfo=om.writeValueAsString(shareBizInfo);
mockMvc.perform( post("/**/share/shareBizInfo/edit").content(jsonShareBizInfo).contentType(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("tips.isOk").value(true));
}
@Test
public void del() throws Exception {
mockMvc.perform( post("/**/share/shareBizInfo/del").content("9303").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("shareKey","9303","shareUserid","zZoc","shareUsername","V9tr","pageUrl","wBF3","pageType","ylHj","shareTime",new Date("2021-04-22 17:12:53"),"bizPkId","c6DC","bizBranchId","5HjB","shareBranchId","0aSc","bizSubPkId","5ps3","params","b175","shareType","q0Jh","pshareKey","it9W","pshareUserid","IaYJ","pshareUsername","GGIz","bizType","9Uqr","bizCategoryId","FL8C");
ShareBizInfo shareBizInfo=BaseUtils.fromMap(p,ShareBizInfo.class);
List<ShareBizInfo> shareBizInfos=new ArrayList<>();
shareBizInfos.add(shareBizInfo);
String jsonShareBizInfo=om.writeValueAsString(shareBizInfos);
mockMvc.perform( post("/**/share/shareBizInfo/batchDel").content(jsonShareBizInfo).contentType(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("tips.isOk").value(true));
}
}

127
xm-core/src/test/java/com/xm/share/ctrl/TestShareReceInfoController.java

@ -0,0 +1,127 @@
package com.xm.share.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.share.entity.ShareReceInfo;
import com.mdp.core.utils.BaseUtils;
/**
* 组织 com<br>
* 顶级模块 xm<br>
* 大模块 share<br>
* 小模块 <br>
* XM.xm_share_rece_info 分享后接收人行为记录表<br>
* 实体 ShareReceInfo<br>
* 表是指数据库结构中的表,实体是指java类型中的实体类<br>
* 当前实体所有属性名:<br>
* id,shareKey,receiverId,receiverName,receTime;<br>
* 当前表的所有字段名:<br>
* id,share_key,receiver_id,receiver_name,rece_time;<br>
* 当前主键(包括多主键):<br>
* id;<br>
**/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class TestShareReceInfoController {
@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("id","1zr2","shareKey","dp61","receiverId","9s6n","receiverName","83i7","receTime",new Date("2021-04-22 17:12:53"));
ShareReceInfo shareReceInfo=BaseUtils.fromMap(p,ShareReceInfo.class);
String jsonShareReceInfo=om.writeValueAsString(shareReceInfo);
mockMvc.perform( post("/**/share/shareReceInfo/add").content(jsonShareReceInfo).contentType(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("tips.isOk").value(true));
}
@Test
public void list() throws Exception {
mockMvc.perform( get("/**/share/shareReceInfo/list")
.param("id","1zr2").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("id","1zr2","shareKey","dp61","receiverId","9s6n","receiverName","83i7","receTime",new Date("2021-04-22 17:12:53"));
ShareReceInfo shareReceInfo=BaseUtils.fromMap(p,ShareReceInfo.class);
String jsonShareReceInfo=om.writeValueAsString(shareReceInfo);
mockMvc.perform( post("/**/share/shareReceInfo/edit").content(jsonShareReceInfo).contentType(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("tips.isOk").value(true));
}
@Test
public void del() throws Exception {
mockMvc.perform( post("/**/share/shareReceInfo/del").content("1zr2").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("id","1zr2","shareKey","dp61","receiverId","9s6n","receiverName","83i7","receTime",new Date("2021-04-22 17:12:53"));
ShareReceInfo shareReceInfo=BaseUtils.fromMap(p,ShareReceInfo.class);
List<ShareReceInfo> shareReceInfos=new ArrayList<>();
shareReceInfos.add(shareReceInfo);
String jsonShareReceInfo=om.writeValueAsString(shareReceInfos);
mockMvc.perform( post("/**/share/shareReceInfo/batchDel").content(jsonShareReceInfo).contentType(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("tips.isOk").value(true));
}
}

51
xm-core/src/test/java/com/xm/share/dao/TestShareBizInfoDao.java

@ -0,0 +1,51 @@
package com.xm.share.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.share.entity.ShareBizInfo;
import org.springframework.boot.test.context.SpringBootTest;
/**
* ShareBizInfoDao的测试案例
* 组织 com<br>
* 顶级模块 xm<br>
* 大模块 share<br>
* 小模块 <br>
* XM.xm_share_biz_info 分享行为记录表<br>
* 实体 ShareBizInfo<br>
* 表是指数据库结构中的表,实体是指java类型中的实体类<br>
* 当前实体所有属性名:<br>
* shareKey,shareUserid,shareUsername,pageUrl,pageType,shareTime,bizPkId,bizBranchId,shareBranchId,bizSubPkId,params,shareType,pshareKey,pshareUserid,pshareUsername,bizType,bizCategoryId;<br>
* 当前表的所有字段名:<br>
* share_key,share_userid,share_username,page_url,page_type,share_time,biz_pk_id,biz_branch_id,share_branch_id,biz_sub_pk_id,params,share_type,pshare_key,pshare_userid,pshare_username,biz_type,biz_category_id;<br>
* 当前主键(包括多主键):<br>
* share_key;<br>
***/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class TestShareBizInfoDao {
@Autowired
BaseDao baseDao;
/**
* 新增一条数据
***/
@Test
public void insert() {
Map<String,Object> p=BaseUtils.map("shareKey","9303","shareUserid","zZoc","shareUsername","V9tr","pageUrl","wBF3","pageType","ylHj","shareTime",new Date("2021-04-22 17:12:53"),"bizPkId","c6DC","bizBranchId","5HjB","shareBranchId","0aSc","bizSubPkId","5ps3","params","b175","shareType","q0Jh","pshareKey","it9W","pshareUserid","IaYJ","pshareUsername","GGIz","bizType","9Uqr","bizCategoryId","FL8C");
ShareBizInfo shareBizInfo=BaseUtils.fromMap(p,ShareBizInfo.class);
baseDao.insert(shareBizInfo);
//Assert.assertEquals(1, result);
}
}

51
xm-core/src/test/java/com/xm/share/dao/TestShareReceInfoDao.java

@ -0,0 +1,51 @@
package com.xm.share.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.share.entity.ShareReceInfo;
import org.springframework.boot.test.context.SpringBootTest;
/**
* ShareReceInfoDao的测试案例
* 组织 com<br>
* 顶级模块 xm<br>
* 大模块 share<br>
* 小模块 <br>
* XM.xm_share_rece_info 分享后接收人行为记录表<br>
* 实体 ShareReceInfo<br>
* 表是指数据库结构中的表,实体是指java类型中的实体类<br>
* 当前实体所有属性名:<br>
* id,shareKey,receiverId,receiverName,receTime;<br>
* 当前表的所有字段名:<br>
* id,share_key,receiver_id,receiver_name,rece_time;<br>
* 当前主键(包括多主键):<br>
* id;<br>
***/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class TestShareReceInfoDao {
@Autowired
BaseDao baseDao;
/**
* 新增一条数据
***/
@Test
public void insert() {
Map<String,Object> p=BaseUtils.map("id","1zr2","shareKey","dp61","receiverId","9s6n","receiverName","83i7","receTime",new Date("2021-04-22 17:12:53"));
ShareReceInfo shareReceInfo=BaseUtils.fromMap(p,ShareReceInfo.class);
baseDao.insert(shareReceInfo);
//Assert.assertEquals(1, result);
}
}

53
xm-core/src/test/java/com/xm/share/service/TestShareBizInfoService.java

@ -0,0 +1,53 @@
package com.xm.share.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.share.service.ShareBizInfoService;
import com.mdp.mybatis.PageUtils;
import com.github.pagehelper.Page;
import com.xm.share.entity.ShareBizInfo;
import org.springframework.boot.test.context.SpringBootTest;
/**
* ShareBizInfoService的测试案例
* 组织 com<br>
* 顶级模块 xm<br>
* 大模块 share<br>
* 小模块 <br>
* XM.xm_share_biz_info 分享行为记录表<br>
* 实体 ShareBizInfo<br>
* 表是指数据库结构中的表,实体是指java类型中的实体类<br>
* 当前实体所有属性名:<br>
* shareKey,shareUserid,shareUsername,pageUrl,pageType,shareTime,bizPkId,bizBranchId,shareBranchId,bizSubPkId,params,shareType,pshareKey,pshareUserid,pshareUsername,bizType,bizCategoryId;<br>
* 当前表的所有字段名:<br>
* share_key,share_userid,share_username,page_url,page_type,share_time,biz_pk_id,biz_branch_id,share_branch_id,biz_sub_pk_id,params,share_type,pshare_key,pshare_userid,pshare_username,biz_type,biz_category_id;<br>
* 当前主键(包括多主键):<br>
* share_key;<br>
***/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class TestShareBizInfoService {
@Autowired
ShareBizInfoService shareBizInfoService;
/**
* 新增一条数据
***/
@Test
public void insert() {
Map<String,Object> p=BaseUtils.map("shareKey","9303","shareUserid","zZoc","shareUsername","V9tr","pageUrl","wBF3","pageType","ylHj","shareTime",new Date("2021-04-22 17:12:53"),"bizPkId","c6DC","bizBranchId","5HjB","shareBranchId","0aSc","bizSubPkId","5ps3","params","b175","shareType","q0Jh","pshareKey","it9W","pshareUserid","IaYJ","pshareUsername","GGIz","bizType","9Uqr","bizCategoryId","FL8C");
ShareBizInfo shareBizInfo=BaseUtils.fromMap(p,ShareBizInfo.class);
shareBizInfoService.insert(shareBizInfo);
//Assert.assertEquals(1, result);
}
}

53
xm-core/src/test/java/com/xm/share/service/TestShareReceInfoService.java

@ -0,0 +1,53 @@
package com.xm.share.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.share.service.ShareReceInfoService;
import com.mdp.mybatis.PageUtils;
import com.github.pagehelper.Page;
import com.xm.share.entity.ShareReceInfo;
import org.springframework.boot.test.context.SpringBootTest;
/**
* ShareReceInfoService的测试案例
* 组织 com<br>
* 顶级模块 xm<br>
* 大模块 share<br>
* 小模块 <br>
* XM.xm_share_rece_info 分享后接收人行为记录表<br>
* 实体 ShareReceInfo<br>
* 表是指数据库结构中的表,实体是指java类型中的实体类<br>
* 当前实体所有属性名:<br>
* id,shareKey,receiverId,receiverName,receTime;<br>
* 当前表的所有字段名:<br>
* id,share_key,receiver_id,receiver_name,rece_time;<br>
* 当前主键(包括多主键):<br>
* id;<br>
***/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class TestShareReceInfoService {
@Autowired
ShareReceInfoService shareReceInfoService;
/**
* 新增一条数据
***/
@Test
public void insert() {
Map<String,Object> p=BaseUtils.map("id","1zr2","shareKey","dp61","receiverId","9s6n","receiverName","83i7","receTime",new Date("2021-04-22 17:12:53"));
ShareReceInfo shareReceInfo=BaseUtils.fromMap(p,ShareReceInfo.class);
shareReceInfoService.insert(shareReceInfo);
//Assert.assertEquals(1, result);
}
}
Loading…
Cancel
Save