5 changed files with 650 additions and 0 deletions
-
296xm-core/src/main/java/com/xm/core/ctrl/XmRecordVisitController.java
-
48xm-core/src/main/java/com/xm/core/ctrl/XmTaskAccessRecordController.java
-
74xm-core/src/main/java/com/xm/core/entity/XmRecordVisit.java
-
24xm-core/src/main/java/com/xm/core/service/XmRecordVisitService.java
-
208xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmRecordVisitMapper.xml
@ -0,0 +1,296 @@ |
|||||
|
package com.xm.core.ctrl; |
||||
|
|
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
import io.swagger.annotations.*; |
||||
|
|
||||
|
import static com.mdp.core.utils.ResponseHelper.*; |
||||
|
import static com.mdp.core.utils.BaseUtils.*; |
||||
|
import com.mdp.core.entity.Tips; |
||||
|
import com.mdp.core.err.BizException; |
||||
|
import com.mdp.mybatis.PageUtils; |
||||
|
import com.mdp.core.utils.RequestUtils; |
||||
|
import com.mdp.core.utils.NumberUtil; |
||||
|
import com.mdp.safe.client.entity.User; |
||||
|
import com.mdp.safe.client.utils.LoginUtils; |
||||
|
import com.mdp.swagger.ApiEntityParams; |
||||
|
import springfox.documentation.annotations.ApiIgnore; |
||||
|
|
||||
|
import com.xm.core.service.XmRecordVisitService; |
||||
|
import com.xm.core.entity.XmRecordVisit; |
||||
|
|
||||
|
/** |
||||
|
* url编制采用rest风格,如对xm_record_visit 重要页面访问记录的操作有增删改查,对应的url分别为:<br> |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmRecordVisit 表 xm_record_visit 当前主键(包括多主键): id; |
||||
|
***/ |
||||
|
@RestController("xm.core.xmRecordVisitController") |
||||
|
@RequestMapping(value="/**/core/xmRecordVisit") |
||||
|
@Api(tags={"重要页面访问记录操作接口"}) |
||||
|
public class XmRecordVisitController { |
||||
|
|
||||
|
static Logger logger =LoggerFactory.getLogger(XmRecordVisitController.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private XmRecordVisitService xmRecordVisitService; |
||||
|
|
||||
|
|
||||
|
Map<String,Object> fieldsMap = toMap(new XmRecordVisit()); |
||||
|
|
||||
|
|
||||
|
@ApiOperation( value = "查询重要页面访问记录信息列表",notes=" ") |
||||
|
@ApiEntityParams( XmRecordVisit.class ) |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name="pageSize",value="每页大小,默认20条",required=false), |
||||
|
@ApiImplicitParam(name="pageNum",value="当前页码,从1开始",required=false), |
||||
|
@ApiImplicitParam(name="total",value="总记录数,服务器端收到0时,会自动计算总记录数,如果上传>0的不自动计算",required=false), |
||||
|
@ApiImplicitParam(name="count",value="是否计算总记录条数,如果count=true,则计算计算总条数,如果count=false 则不计算",required=false), |
||||
|
@ApiImplicitParam(name="orderBy",value="排序列 如性别、学生编号排序 orderBy = sex desc,student desc",required=false), |
||||
|
}) |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmRecordVisit.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
||||
|
}) |
||||
|
@RequestMapping(value="/list",method=RequestMethod.GET) |
||||
|
public Map<String,Object> listXmRecordVisit( @ApiIgnore @RequestParam Map<String,Object> xmRecordVisit){ |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("查询成功"); |
||||
|
RequestUtils.transformArray(xmRecordVisit, "ids"); |
||||
|
PageUtils.startPage(xmRecordVisit); |
||||
|
List<Map<String,Object>> xmRecordVisitList = xmRecordVisitService.selectListMapByWhere(xmRecordVisit); //列出XmRecordVisit列表 |
||||
|
PageUtils.responePage(m, xmRecordVisitList); |
||||
|
m.put("data",xmRecordVisitList); |
||||
|
|
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "新增一条重要页面访问记录信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmRecordVisit.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/add",method=RequestMethod.POST) |
||||
|
public Map<String,Object> addXmRecordVisit(@RequestBody XmRecordVisit xmRecordVisit) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功新增一条数据"); |
||||
|
try{ |
||||
|
boolean createPk=false; |
||||
|
if(!StringUtils.hasText(xmRecordVisit.getId())) { |
||||
|
createPk=true; |
||||
|
xmRecordVisit.setId(xmRecordVisitService.createKey("id")); |
||||
|
} |
||||
|
if(createPk==false){ |
||||
|
if(xmRecordVisitService.selectOneObject(xmRecordVisit) !=null ){ |
||||
|
return failed("pk-exists","编号重复,请修改编号再提交"); |
||||
|
} |
||||
|
} |
||||
|
xmRecordVisitService.insert(xmRecordVisit); |
||||
|
m.put("data",xmRecordVisit); |
||||
|
}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> delXmRecordVisit(@RequestBody XmRecordVisit xmRecordVisit){ |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功删除一条数据"); |
||||
|
try{ |
||||
|
if(!StringUtils.hasText(xmRecordVisit.getId())) { |
||||
|
return failed("pk-not-exists","请上送主键参数id"); |
||||
|
} |
||||
|
XmRecordVisit xmRecordVisitDb = xmRecordVisitService.selectOneObject(xmRecordVisit); |
||||
|
if( xmRecordVisitDb == null ){ |
||||
|
return failed("data-not-exists","数据不存在,无法删除"); |
||||
|
} |
||||
|
xmRecordVisitService.deleteByPk(xmRecordVisit); |
||||
|
}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=XmRecordVisit.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/edit",method=RequestMethod.POST) |
||||
|
public Map<String,Object> editXmRecordVisit(@RequestBody XmRecordVisit xmRecordVisit) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功更新一条数据"); |
||||
|
try{ |
||||
|
if(!StringUtils.hasText(xmRecordVisit.getId())) { |
||||
|
return failed("pk-not-exists","请上送主键参数id"); |
||||
|
} |
||||
|
XmRecordVisit xmRecordVisitDb = xmRecordVisitService.selectOneObject(xmRecordVisit); |
||||
|
if( xmRecordVisitDb == null ){ |
||||
|
return failed("data-not-exists","数据不存在,无法修改"); |
||||
|
} |
||||
|
xmRecordVisitService.updateSomeFieldByPk(xmRecordVisit); |
||||
|
m.put("data",xmRecordVisit); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "批量修改某些字段",notes="") |
||||
|
@ApiEntityParams( value = XmRecordVisit.class, props={ }, remark = "重要页面访问记录", paramType = "body" ) |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200,response=XmRecordVisit.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
||||
|
}) |
||||
|
@RequestMapping(value="/editSomeFields",method=RequestMethod.POST) |
||||
|
public Map<String,Object> editSomeFields( @ApiIgnore @RequestBody Map<String,Object> xmRecordVisitMap) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功更新一条数据"); |
||||
|
try{ |
||||
|
List<String> ids= (List<String>) xmRecordVisitMap.get("ids"); |
||||
|
if(ids==null || ids.size()==0){ |
||||
|
return failed("ids-0","ids不能为空"); |
||||
|
} |
||||
|
|
||||
|
Set<String> fields=new HashSet<>(); |
||||
|
fields.add("id"); |
||||
|
for (String fieldName : xmRecordVisitMap.keySet()) { |
||||
|
if(fields.contains(fieldName)){ |
||||
|
return failed(fieldName+"-no-edit",fieldName+"不允许修改"); |
||||
|
} |
||||
|
} |
||||
|
Set<String> fieldKey=xmRecordVisitMap.keySet().stream().filter(i-> fieldsMap.containsKey(i)).collect(Collectors.toSet()); |
||||
|
fieldKey=fieldKey.stream().filter(i->!StringUtils.isEmpty(xmRecordVisitMap.get(i) )).collect(Collectors.toSet()); |
||||
|
|
||||
|
if(fieldKey.size()<=0) { |
||||
|
return failed("fieldKey-0","没有需要更新的字段"); |
||||
|
} |
||||
|
XmRecordVisit xmRecordVisit = fromMap(xmRecordVisitMap,XmRecordVisit.class); |
||||
|
List<XmRecordVisit> xmRecordVisitsDb=xmRecordVisitService.selectListByIds(ids); |
||||
|
if(xmRecordVisitsDb==null ||xmRecordVisitsDb.size()==0){ |
||||
|
return failed("data-0","记录已不存在"); |
||||
|
} |
||||
|
List<XmRecordVisit> can=new ArrayList<>(); |
||||
|
List<XmRecordVisit> no=new ArrayList<>(); |
||||
|
User user = LoginUtils.getCurrentUserInfo(); |
||||
|
for (XmRecordVisit xmRecordVisitDb : xmRecordVisitsDb) { |
||||
|
Tips tips2 = new Tips("检查通过"); |
||||
|
if(!tips2.isOk()){ |
||||
|
no.add(xmRecordVisitDb); |
||||
|
}else{ |
||||
|
can.add(xmRecordVisitDb); |
||||
|
} |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
xmRecordVisitMap.put("ids",can.stream().map(i->i.getId()).collect(Collectors.toList())); |
||||
|
xmRecordVisitService.editSomeFields(xmRecordVisitMap); |
||||
|
} |
||||
|
List<String> msgs=new ArrayList<>(); |
||||
|
if(can.size()>0){ |
||||
|
msgs.add(String.format("成功更新以下%s条数据",can.size())); |
||||
|
} |
||||
|
if(no.size()>0){ |
||||
|
msgs.add(String.format("以下%s个数据无权限更新",no.size())); |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
tips.setOkMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
}else { |
||||
|
tips.setFailureMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
} |
||||
|
//m.put("data",xmMenu); |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
@ApiOperation( value = "根据主键列表批量删除重要页面访问记录信息",notes=" ") |
||||
|
@ApiResponses({ |
||||
|
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") |
||||
|
}) |
||||
|
@RequestMapping(value="/batchDel",method=RequestMethod.POST) |
||||
|
public Map<String,Object> batchDelXmRecordVisit(@RequestBody List<XmRecordVisit> xmRecordVisits) { |
||||
|
Map<String,Object> m = new HashMap<>(); |
||||
|
Tips tips=new Tips("成功删除"); |
||||
|
try{ |
||||
|
if(xmRecordVisits.size()<=0){ |
||||
|
return failed("data-0","请上送待删除数据列表"); |
||||
|
} |
||||
|
List<XmRecordVisit> datasDb=xmRecordVisitService.selectListByIds(xmRecordVisits.stream().map(i-> i.getId() ).collect(Collectors.toList())); |
||||
|
|
||||
|
List<XmRecordVisit> can=new ArrayList<>(); |
||||
|
List<XmRecordVisit> no=new ArrayList<>(); |
||||
|
for (XmRecordVisit data : datasDb) { |
||||
|
if(true){ |
||||
|
can.add(data); |
||||
|
}else{ |
||||
|
no.add(data); |
||||
|
} |
||||
|
} |
||||
|
List<String> msgs=new ArrayList<>(); |
||||
|
if(can.size()>0){ |
||||
|
xmRecordVisitService.batchDelete(can); |
||||
|
msgs.add(String.format("成功删除%s条数据.",can.size())); |
||||
|
} |
||||
|
|
||||
|
if(no.size()>0){ |
||||
|
msgs.add(String.format("以下%s条数据不能删除.【%s】",no.size(),no.stream().map(i-> i.getId() ).collect(Collectors.joining(",")))); |
||||
|
} |
||||
|
if(can.size()>0){ |
||||
|
tips.setOkMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
}else { |
||||
|
tips.setFailureMsg(msgs.stream().collect(Collectors.joining())); |
||||
|
} |
||||
|
}catch (BizException e) { |
||||
|
tips=e.getTips(); |
||||
|
logger.error("",e); |
||||
|
}catch (Exception e) { |
||||
|
tips.setFailureMsg(e.getMessage()); |
||||
|
logger.error("",e); |
||||
|
} |
||||
|
m.put("tips", tips); |
||||
|
return m; |
||||
|
} |
||||
|
*/ |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
package com.xm.core.ctrl; |
||||
|
|
||||
|
import com.mdp.core.utils.ResponseHelper; |
||||
|
import com.mdp.safe.client.entity.User; |
||||
|
import com.mdp.safe.client.utils.LoginUtils; |
||||
|
import com.xm.core.entity.XmTask; |
||||
|
import com.xm.core.service.XmTaskService; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.apache.commons.logging.Log; |
||||
|
import org.apache.commons.logging.LogFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
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.RestController; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* url编制采用rest风格,如对XM.xm_task xm_task的操作有增删改查,对应的url分别为:<br> |
||||
|
* 新增: xm/xmTask/add <br> |
||||
|
* 查询: xm/xmTask/list<br> |
||||
|
* 模糊查询: xm/xmTask/listKey<br> |
||||
|
* 修改: xm/xmTask/edit <br> |
||||
|
* 删除: xm/xmTask/del<br> |
||||
|
* 批量删除: xm/xmTask/batchDel<br> |
||||
|
* 组织 com.qqkj 顶级模块 oa 大模块 xm 小模块 <br> |
||||
|
* 实体 XmTask 表 XM.xm_task 当前主键(包括多主键): id; |
||||
|
***/ |
||||
|
@RestController("xm.core.xmTaskController") |
||||
|
@RequestMapping(value="/**/xm/core/xmTask") |
||||
|
@Api(tags={"任务操作接口"}) |
||||
|
public class XmTaskAccessRecordController { |
||||
|
|
||||
|
static Log logger=LogFactory.getLog(XmTaskAccessRecordController.class); |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private XmTaskService xmTaskService; |
||||
|
|
||||
|
@ApiOperation("统计所有上级的进度情况") |
||||
|
@RequestMapping(value="/accessLog",method=RequestMethod.POST) |
||||
|
public Map<String,Object> calcProgress( @RequestBody XmTask xmTask){ |
||||
|
User user=LoginUtils.getCurrentUserInfo(); |
||||
|
return ResponseHelper.ok("成功"); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,74 @@ |
|||||
|
package com.xm.core.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmRecordVisit所有属性名: <br> |
||||
|
* "id","日志编号","operUserid","操作人id","operUsername","操作人名字","operTime","操作时间","objType","对象类型:项目-1/任务-2/产品-3/需求-4/bug-5/迭代6","action","操作的id","remarks","备注-只描述新旧值之间的变化","gloNo","全局根踪号,用于跟踪日志","branchId","机构编号","ip","ip地址","bizId","业务主键编号","pbizId","对象上级编号,项目时填项目编号,任务时填项目编号,产品时填产品编号,需求时填产品编号,bug时填产品编号,迭代时填产品编号","bizName","对象名称";<br> |
||||
|
* 当前主键(包括多主键):<br> |
||||
|
* id;<br> |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(description="重要页面访问记录") |
||||
|
public class XmRecordVisit implements java.io.Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@ApiModelProperty(notes="日志编号,主键",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String id; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty(notes="操作人id",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String operUserid; |
||||
|
|
||||
|
@ApiModelProperty(notes="操作人名字",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String operUsername; |
||||
|
|
||||
|
@ApiModelProperty(notes="操作时间",allowEmptyValue=true,example="",allowableValues="") |
||||
|
Date operTime; |
||||
|
|
||||
|
@ApiModelProperty(notes="对象类型:项目-1/任务-2/产品-3/需求-4/bug-5/迭代6",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String objType; |
||||
|
|
||||
|
@ApiModelProperty(notes="操作的id",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String action; |
||||
|
|
||||
|
@ApiModelProperty(notes="备注-只描述新旧值之间的变化",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String remarks; |
||||
|
|
||||
|
@ApiModelProperty(notes="全局根踪号,用于跟踪日志",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String gloNo; |
||||
|
|
||||
|
@ApiModelProperty(notes="机构编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String branchId; |
||||
|
|
||||
|
@ApiModelProperty(notes="ip地址",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String ip; |
||||
|
|
||||
|
@ApiModelProperty(notes="业务主键编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String bizId; |
||||
|
|
||||
|
@ApiModelProperty(notes="对象上级编号,项目时填项目编号,任务时填项目编号,产品时填产品编号,需求时填产品编号,bug时填产品编号,迭代时填产品编号",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String pbizId; |
||||
|
|
||||
|
@ApiModelProperty(notes="对象名称",allowEmptyValue=true,example="",allowableValues="") |
||||
|
String bizName; |
||||
|
|
||||
|
/** |
||||
|
*日志编号 |
||||
|
**/ |
||||
|
public XmRecordVisit(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 重要页面访问记录 |
||||
|
**/ |
||||
|
public XmRecordVisit() { |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.xm.core.service; |
||||
|
|
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.mdp.core.service.BaseService; |
||||
|
import static com.mdp.core.utils.BaseUtils.*; |
||||
|
import com.mdp.core.entity.Tips; |
||||
|
import com.mdp.core.err.BizException; |
||||
|
|
||||
|
import com.xm.core.entity.XmRecordVisit; |
||||
|
/** |
||||
|
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br> |
||||
|
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
||||
|
* 实体 XmRecordVisit 表 xm_record_visit 当前主键(包括多主键): id; |
||||
|
***/ |
||||
|
@Service("xm.core.xmRecordVisitService") |
||||
|
public class XmRecordVisitService extends BaseService { |
||||
|
static Logger logger =LoggerFactory.getLogger(XmRecordVisitService.class); |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,208 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.xm.core.entity.XmRecordVisit"> |
||||
|
|
||||
|
|
||||
|
<!--开始 自定sql函数区域 请在此区域添加自定义函数,其它区域尽量不要动,因为代码随时重新生成 --> |
||||
|
|
||||
|
<sql id="whereForMap"> |
||||
|
<if test=" ids != null"> and (res.id) in |
||||
|
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</if> |
||||
|
<if test="key != null and key !='' "> </if> |
||||
|
</sql> |
||||
|
|
||||
|
|
||||
|
<!--结束 自定义sql函数区域--> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<!-- 通过条件查询获取数据列表 返回list<map> --> |
||||
|
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap"> |
||||
|
select * from xm_record_visit res |
||||
|
<where> |
||||
|
<include refid="whereForMap"/> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> --> |
||||
|
<select id="selectListByWhere" parameterType="com.xm.core.entity.XmRecordVisit" resultType="com.xm.core.entity.XmRecordVisit"> |
||||
|
select * from xm_record_visit res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<!-- 通过主键查询获取数据对象 返回object --> |
||||
|
<select id="selectOneObject" parameterType="com.xm.core.entity.XmRecordVisit" resultType="com.xm.core.entity.XmRecordVisit"> |
||||
|
select * from xm_record_visit res |
||||
|
where |
||||
|
res.id = #{id} |
||||
|
</select> |
||||
|
<select id="selectListByIds" parameterType="List" resultType="com.xm.core.entity.XmRecordVisit"> |
||||
|
select * from xm_record_visit res |
||||
|
where (res.id) in |
||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</select> |
||||
|
<!-- 通过主键查询获取数据对象 返回map--> |
||||
|
<select id="selectOneMap" parameterType="HashMap" resultType="HashMap"> |
||||
|
select * from xm_record_visit res |
||||
|
where |
||||
|
res.id = #{id} |
||||
|
</select> |
||||
|
<!-- 获取数据条目 返回long --> |
||||
|
<select id="countByWhere" parameterType="com.xm.core.entity.XmRecordVisit" resultType="long"> |
||||
|
select count(*) from xm_record_visit res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</select> |
||||
|
<!-- 新增一条记录 主键id,--> |
||||
|
<insert id="insert" parameterType="com.xm.core.entity.XmRecordVisit" useGeneratedKeys="false" keyProperty="id"> |
||||
|
insert into xm_record_visit( |
||||
|
<include refid="columns"/> |
||||
|
) values ( |
||||
|
#{id},#{operUserid},#{operUsername},#{operTime},#{objType},#{action},#{remarks},#{gloNo},#{branchId},#{ip},#{bizId},#{pbizId},#{bizName} |
||||
|
) |
||||
|
</insert> |
||||
|
|
||||
|
<!-- 按条件删除若干条记录--> |
||||
|
<delete id="deleteByWhere" parameterType="com.xm.core.entity.XmRecordVisit"> |
||||
|
delete from xm_record_visit res |
||||
|
<where> |
||||
|
<include refid="where"/> |
||||
|
</where> |
||||
|
</delete> |
||||
|
|
||||
|
<!-- 按主键删除一条记录--> |
||||
|
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmRecordVisit"> |
||||
|
delete from xm_record_visit |
||||
|
where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
<!-- 根据条件修改若干条记录 --> |
||||
|
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmRecordVisit"> |
||||
|
update xm_record_visit |
||||
|
<set> |
||||
|
<include refid="someFieldSet"/> |
||||
|
</set> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<!-- 根据主键修改一条记录 --> |
||||
|
<update id="updateByPk" parameterType="com.xm.core.entity.XmRecordVisit"> |
||||
|
update xm_record_visit |
||||
|
<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_record_visit |
||||
|
set |
||||
|
<include refid="batchSet"/> |
||||
|
where id = #{item.id} |
||||
|
</foreach> |
||||
|
</update> |
||||
|
|
||||
|
<!-- 批量修改某几个字段 --> |
||||
|
<delete id="editSomeFields" parameterType="HashMap"> |
||||
|
update xm_record_visit |
||||
|
<set> |
||||
|
<include refid="someFieldSet"/> |
||||
|
</set> |
||||
|
where (id) in |
||||
|
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item}) |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
<!-- 批量删除 --> |
||||
|
<delete id="batchDelete" parameterType="List"> |
||||
|
delete from xm_record_visit |
||||
|
where |
||||
|
(id) in |
||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
||||
|
( #{item.id} ) |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
|
||||
|
<!--sql片段 列--> |
||||
|
<sql id="columns"> |
||||
|
id,oper_userid,oper_username,oper_time,obj_type,action,remarks,glo_no,branch_id,ip,biz_id,pbiz_id,biz_name |
||||
|
</sql> |
||||
|
|
||||
|
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS--> |
||||
|
<sql id="where"> |
||||
|
<if test="id != null and id != ''"> and res.id = #{id} </if> |
||||
|
<if test="operUserid != null and operUserid != ''"> and res.oper_userid = #{operUserid} </if> |
||||
|
<if test="operUsername != null and operUsername != ''"> and res.oper_username = #{operUsername} </if> |
||||
|
<if test="operTime != null"> and date_format(res.oper_time,'%Y-%m-%d') = date_format(#{operTime},'%Y-%m-%d') </if> |
||||
|
<if test="objType != null and objType != ''"> and res.obj_type = #{objType} </if> |
||||
|
<if test="action != null and action != ''"> and res.action = #{action} </if> |
||||
|
<if test="remarks != null and remarks != ''"> and res.remarks = #{remarks} </if> |
||||
|
<if test="gloNo != null and gloNo != ''"> and res.glo_no = #{gloNo} </if> |
||||
|
<if test="branchId != null and branchId != ''"> and res.branch_id = #{branchId} </if> |
||||
|
<if test="ip != null and ip != ''"> and res.ip = #{ip} </if> |
||||
|
<if test="bizId != null and bizId != ''"> and res.biz_id = #{bizId} </if> |
||||
|
<if test="pbizId != null and pbizId != ''"> and res.pbiz_id = #{pbizId} </if> |
||||
|
<if test="bizName != null and bizName != ''"> and res.biz_name = #{bizName} </if> |
||||
|
</sql> |
||||
|
<!--sql片段 更新字段 --> |
||||
|
<sql id="set"> |
||||
|
oper_userid = #{operUserid}, |
||||
|
oper_username = #{operUsername}, |
||||
|
oper_time = #{operTime}, |
||||
|
obj_type = #{objType}, |
||||
|
action = #{action}, |
||||
|
remarks = #{remarks}, |
||||
|
glo_no = #{gloNo}, |
||||
|
branch_id = #{branchId}, |
||||
|
ip = #{ip}, |
||||
|
biz_id = #{bizId}, |
||||
|
pbiz_id = #{pbizId}, |
||||
|
biz_name = #{bizName} |
||||
|
</sql> |
||||
|
<sql id="someFieldSet"> |
||||
|
<if test="operUserid != null and operUserid != ''"> oper_userid = #{operUserid}, </if> |
||||
|
<if test="operUsername != null and operUsername != ''"> oper_username = #{operUsername}, </if> |
||||
|
<if test="operTime != null"> oper_time = #{operTime}, </if> |
||||
|
<if test="objType != null and objType != ''"> obj_type = #{objType}, </if> |
||||
|
<if test="action != null and action != ''"> action = #{action}, </if> |
||||
|
<if test="remarks != null and remarks != ''"> remarks = #{remarks}, </if> |
||||
|
<if test="gloNo != null and gloNo != ''"> glo_no = #{gloNo}, </if> |
||||
|
<if test="branchId != null and branchId != ''"> branch_id = #{branchId}, </if> |
||||
|
<if test="ip != null and ip != ''"> ip = #{ip}, </if> |
||||
|
<if test="bizId != null and bizId != ''"> biz_id = #{bizId}, </if> |
||||
|
<if test="pbizId != null and pbizId != ''"> pbiz_id = #{pbizId}, </if> |
||||
|
<if test="bizName != null and bizName != ''"> biz_name = #{bizName}, </if> |
||||
|
</sql> |
||||
|
<!--sql片段 批量更新 --> |
||||
|
<sql id="batchSet"> |
||||
|
oper_userid = #{item.operUserid}, |
||||
|
oper_username = #{item.operUsername}, |
||||
|
oper_time = #{item.operTime}, |
||||
|
obj_type = #{item.objType}, |
||||
|
action = #{item.action}, |
||||
|
remarks = #{item.remarks}, |
||||
|
glo_no = #{item.gloNo}, |
||||
|
branch_id = #{item.branchId}, |
||||
|
ip = #{item.ip}, |
||||
|
biz_id = #{item.bizId}, |
||||
|
pbiz_id = #{item.pbizId}, |
||||
|
biz_name = #{item.bizName} |
||||
|
</sql> |
||||
|
</mapper> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue