5 changed files with 581 additions and 204 deletions
-
204xm-core-ui/src/views/xm/core/xmMenuComment/XmMenuCommentEdit.vue
-
296xm-core/src/main/java/com/xm/core/ctrl/XmRptDataController.java
-
65xm-core/src/main/java/com/xm/core/entity/XmRptData.java
-
24xm-core/src/main/java/com/xm/core/service/XmRptDataService.java
-
196xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmRptDataMapper.xml
@ -1,204 +0,0 @@ |
|||
<template> |
|||
<section class="page-container padding"> |
|||
<el-row class="page-header"> |
|||
</el-row> |
|||
<el-row class="page-main" :style="{overflowX:'auto',height:maxTableHeight+'px'}" ref="table"> |
|||
<!--编辑界面 XmMenuComment 档案评论表--> |
|||
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef"> |
|||
<el-form-item label="主键" prop="id"> |
|||
<el-input v-model="editForm.id" placeholder="主键" :maxlength="50" @change="editSomeFields(editForm,'id',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="评论人" prop="userid"> |
|||
<el-input v-model="editForm.userid" placeholder="评论人" :maxlength="50" @change="editSomeFields(editForm,'userid',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="评论人姓名" prop="username"> |
|||
<el-input v-model="editForm.username" placeholder="评论人姓名" :maxlength="50" @change="editSomeFields(editForm,'username',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="星级" prop="star"> |
|||
<el-input v-model="editForm.star" placeholder="星级" :maxlength="1" @change="editSomeFields(editForm,'star',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="时间" prop="cdate"> |
|||
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.cdate" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker> |
|||
</el-form-item> |
|||
<el-form-item label="需求编号" prop="menuId"> |
|||
<el-input v-model="editForm.menuId" placeholder="需求编号" :maxlength="50" @change="editSomeFields(editForm,'menuId',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="上级评论" prop="pid"> |
|||
<el-input v-model="editForm.pid" placeholder="上级评论" :maxlength="50" @change="editSomeFields(editForm,'pid',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="点赞数量" prop="ups"> |
|||
<el-input v-model="editForm.ups" placeholder="点赞数量" :maxlength="10"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="是否显示0否1是" prop="isShow"> |
|||
<el-input v-model="editForm.isShow" placeholder="是否显示0否1是" :maxlength="1" @change="editSomeFields(editForm,'isShow',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="回复用户编号" prop="toUserid"> |
|||
<el-input v-model="editForm.toUserid" placeholder="回复用户编号" :maxlength="50" @change="editSomeFields(editForm,'toUserid',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="回复用户名" prop="toUsername"> |
|||
<el-input v-model="editForm.toUsername" placeholder="回复用户名" :maxlength="50" @change="editSomeFields(editForm,'toUsername',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="层级0,1,2,3,4" prop="lvl"> |
|||
<el-input v-model="editForm.lvl" placeholder="层级0,1,2,3,4" :maxlength="1" @change="editSomeFields(editForm,'lvl',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="评论内容" prop="context"> |
|||
<el-input v-model="editForm.context" placeholder="评论内容" :maxlength="65535" @change="editSomeFields(editForm,'context',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="机构编号" prop="branchId"> |
|||
<el-input v-model="editForm.branchId" placeholder="机构编号" :maxlength="50" @change="editSomeFields(editForm,'branchId',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="ip地址" prop="ip"> |
|||
<el-input v-model="editForm.ip" placeholder="ip地址" :maxlength="50" @change="editSomeFields(editForm,'ip',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="城市编号" prop="cityId"> |
|||
<el-input v-model="editForm.cityId" placeholder="城市编号" :maxlength="50" @change="editSomeFields(editForm,'cityId',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="城市名称" prop="cityName"> |
|||
<el-input v-model="editForm.cityName" placeholder="城市名称" :maxlength="50" @change="editSomeFields(editForm,'cityName',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="状态0未审核,1已审核,3审核不通过" prop="status"> |
|||
<el-input v-model="editForm.status" placeholder="状态0未审核,1已审核,3审核不通过" :maxlength="1" @change="editSomeFields(editForm,'status',$event)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="儿子节点数量" prop="childNums"> |
|||
<el-input-number v-model="editForm.childNums" :min="0" :max="200"></el-input-number> |
|||
</el-form-item> |
|||
</el-form> |
|||
</el-row> |
|||
|
|||
<el-row v-if="opType=='add'" class="page-bottom bottom-fixed"> |
|||
<el-button @click.native="handleCancel">取消</el-button> |
|||
<el-button v-loading="load.edit" type="primary" @click.native="saveSubmit" :disabled="load.edit==true">提交</el-button> |
|||
</el-row> |
|||
</section> |
|||
</template> |
|||
|
|||
<script> |
|||
import util from '@/common/js/util';//全局公共库 |
|||
import config from "@/common/config"; //全局公共库import |
|||
import { initDicts, addXmMenuComment,editXmMenuComment,editSomeFieldsXmMenuComment } from '@/api/xm/core/xmMenuComment'; |
|||
import { mapGetters } from 'vuex' |
|||
|
|||
export default { |
|||
name:'xmMenuCommentEdit', |
|||
components: { |
|||
|
|||
}, |
|||
computed: { |
|||
...mapGetters([ 'userInfo' ]), |
|||
|
|||
}, |
|||
props:['xmMenuComment','visible','opType'], |
|||
|
|||
watch: { |
|||
'xmMenuComment':function( xmMenuComment ) { |
|||
if(xmMenuComment){ |
|||
this.editForm = {...xmMenuComment}; |
|||
} |
|||
|
|||
}, |
|||
'visible':function(visible) { |
|||
if(visible==true){ |
|||
this.initData() |
|||
} |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
currOpType:'add',//add/edit |
|||
load:{ list: false, edit: false, del: false, add: false },//查询中... |
|||
dicts:{},//下拉选择框的所有静态数据 params={categoryId:'all',itemCodes:['sex']} 返回结果 {sex: [{id:'1',name:'男'},{id:'2',name:'女'}]} |
|||
editFormRules: { |
|||
id: [ |
|||
//{ required: true, message: '主键不能为空', trigger: 'blur' } |
|||
] |
|||
}, |
|||
editForm: { |
|||
id:'',userid:'',username:'',star:'',cdate:'',menuId:'',pid:'',ups:'',isShow:'',toUserid:'',toUsername:'',lvl:'',context:'',branchId:'',ip:'',cityId:'',cityName:'',status:'',childNums:'' |
|||
}, |
|||
maxTableHeight:300, |
|||
}//end return |
|||
},//end data |
|||
methods: { |
|||
|
|||
...util, |
|||
|
|||
// 取消按钮点击 父组件监听@cancel="editFormVisible=false" 监听 |
|||
handleCancel:function(){ |
|||
this.$refs['editFormRef'].resetFields(); |
|||
this.$emit('cancel'); |
|||
}, |
|||
//新增、编辑提交XmMenuComment 档案评论表父组件监听@submit="afterEditSubmit" |
|||
saveSubmit: function () { |
|||
this.$refs.editFormRef.validate((valid) => { |
|||
if (valid) { |
|||
this.$confirm('确认提交吗?', '提示', {}).then(() => { |
|||
this.load.edit=true |
|||
let params = Object.assign({}, this.editForm); |
|||
var func=addXmMenuComment |
|||
if(this.currOpType=='edit'){ |
|||
func=editXmMenuComment |
|||
} |
|||
func(params).then((res) => { |
|||
this.load.edit=false |
|||
var tips=res.data.tips; |
|||
if(tips.isOk){ |
|||
this.editForm=res.data.data |
|||
this.initData() |
|||
this.currOpType="edit"; |
|||
this.$emit('submit');// @submit="afterAddSubmit" |
|||
} |
|||
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error' }); |
|||
}).catch( err =>this.load.edit=false); |
|||
}); |
|||
}else{ |
|||
this.$notify({ showClose:true, message: "表单验证不通过,请修改表单数据再提交", type: 'error' }); |
|||
} |
|||
}); |
|||
}, |
|||
initData: function(){ |
|||
this.currOpType=this.opType |
|||
if(this.xmMenuComment){ |
|||
this.editForm = Object.assign({},this.xmMenuComment); |
|||
} |
|||
|
|||
if(this.opType=='edit'){ |
|||
|
|||
}else{ |
|||
|
|||
} |
|||
this.editFormBak={...this.editForm} |
|||
}, |
|||
|
|||
editSomeFields(row,fieldName,$event){ |
|||
if(this.opType=='add'){ |
|||
return; |
|||
} |
|||
let params={}; |
|||
params['ids']=[row].map(i=>i.id) |
|||
params[fieldName]=$event |
|||
var func = editSomeFieldsXmMenuComment |
|||
func(params).then(res=>{ |
|||
let tips = res.data.tips; |
|||
if(tips.isOk){ |
|||
this.editFormBak=[...this.editForm] |
|||
}else{ |
|||
Object.assign(this.editForm,this.editFormBak) |
|||
this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'}) |
|||
} |
|||
}).catch((e)=>Object.assign(this.editForm,this.editFormBak)) |
|||
}, |
|||
},//end method |
|||
mounted() { |
|||
this.$nextTick(() => { |
|||
initDicts(this); |
|||
this.initData() |
|||
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.table.$el) |
|||
}); |
|||
} |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
|||
@ -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 io.swagger.annotations.*; |
|||
import springfox.documentation.annotations.ApiIgnore; |
|||
|
|||
import com.xm.core.service.XmRptDataService; |
|||
import com.xm.core.entity.XmRptData; |
|||
|
|||
/** |
|||
* url编制采用rest风格,如对xm_rpt_data xm_rpt_data的操作有增删改查,对应的url分别为:<br> |
|||
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
|||
* 实体 XmRptData 表 xm_rpt_data 当前主键(包括多主键): id; |
|||
***/ |
|||
@RestController("xm.core.xmRptDataController") |
|||
@RequestMapping(value="/**/core/xmRptData") |
|||
@Api(tags={"xm_rpt_data操作接口"}) |
|||
public class XmRptDataController { |
|||
|
|||
static Logger logger =LoggerFactory.getLogger(XmRptDataController.class); |
|||
|
|||
@Autowired |
|||
private XmRptDataService xmRptDataService; |
|||
|
|||
|
|||
Map<String,Object> fieldsMap = toMap(new XmRptData()); |
|||
|
|||
|
|||
@ApiOperation( value = "查询xm_rpt_data信息列表",notes=" ") |
|||
@ApiEntityParams( XmRptData.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=XmRptData.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") |
|||
}) |
|||
@RequestMapping(value="/list",method=RequestMethod.GET) |
|||
public Map<String,Object> listXmRptData( @ApiIgnore @RequestParam Map<String,Object> xmRptData){ |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("查询成功"); |
|||
RequestUtils.transformArray(xmRptData, "ids"); |
|||
PageUtils.startPage(xmRptData); |
|||
List<Map<String,Object>> xmRptDataList = xmRptDataService.selectListMapByWhere(xmRptData); //列出XmRptData列表 |
|||
PageUtils.responePage(m, xmRptDataList); |
|||
m.put("data",xmRptDataList); |
|||
|
|||
m.put("tips", tips); |
|||
return m; |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
@ApiOperation( value = "新增一条xm_rpt_data信息",notes=" ") |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200,response=XmRptData.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|||
}) |
|||
@RequestMapping(value="/add",method=RequestMethod.POST) |
|||
public Map<String,Object> addXmRptData(@RequestBody XmRptData xmRptData) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功新增一条数据"); |
|||
try{ |
|||
boolean createPk=false; |
|||
if(!StringUtils.hasText(xmRptData.getId())) { |
|||
createPk=true; |
|||
xmRptData.setId(xmRptDataService.createKey("id")); |
|||
} |
|||
if(createPk==false){ |
|||
if(xmRptDataService.selectOneObject(xmRptData) !=null ){ |
|||
return failed("pk-exists","编号重复,请修改编号再提交"); |
|||
} |
|||
} |
|||
xmRptDataService.insert(xmRptData); |
|||
m.put("data",xmRptData); |
|||
}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 = "删除一条xm_rpt_data信息",notes=" ") |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") |
|||
}) |
|||
@RequestMapping(value="/del",method=RequestMethod.POST) |
|||
public Map<String,Object> delXmRptData(@RequestBody XmRptData xmRptData){ |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功删除一条数据"); |
|||
try{ |
|||
if(!StringUtils.hasText(xmRptData.getId())) { |
|||
return failed("pk-not-exists","请上送主键参数id"); |
|||
} |
|||
XmRptData xmRptDataDb = xmRptDataService.selectOneObject(xmRptData); |
|||
if( xmRptDataDb == null ){ |
|||
return failed("data-not-exists","数据不存在,无法删除"); |
|||
} |
|||
xmRptDataService.deleteByPk(xmRptData); |
|||
}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 = "根据主键修改一条xm_rpt_data信息",notes=" ") |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200,response=XmRptData.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") |
|||
}) |
|||
@RequestMapping(value="/edit",method=RequestMethod.POST) |
|||
public Map<String,Object> editXmRptData(@RequestBody XmRptData xmRptData) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功更新一条数据"); |
|||
try{ |
|||
if(!StringUtils.hasText(xmRptData.getId())) { |
|||
return failed("pk-not-exists","请上送主键参数id"); |
|||
} |
|||
XmRptData xmRptDataDb = xmRptDataService.selectOneObject(xmRptData); |
|||
if( xmRptDataDb == null ){ |
|||
return failed("data-not-exists","数据不存在,无法修改"); |
|||
} |
|||
xmRptDataService.updateSomeFieldByPk(xmRptData); |
|||
m.put("data",xmRptData); |
|||
}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 = XmRptData.class, props={ }, remark = "xm_rpt_data", paramType = "body" ) |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200,response=XmRptData.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> xmRptDataMap) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功更新一条数据"); |
|||
try{ |
|||
List<String> ids= (List<String>) xmRptDataMap.get("ids"); |
|||
if(ids==null || ids.size()==0){ |
|||
return failed("ids-0","ids不能为空"); |
|||
} |
|||
|
|||
Set<String> fields=new HashSet<>(); |
|||
fields.add("id"); |
|||
for (String fieldName : xmRptDataMap.keySet()) { |
|||
if(fields.contains(fieldName)){ |
|||
return failed(fieldName+"-no-edit",fieldName+"不允许修改"); |
|||
} |
|||
} |
|||
Set<String> fieldKey=xmRptDataMap.keySet().stream().filter(i-> fieldsMap.containsKey(i)).collect(Collectors.toSet()); |
|||
fieldKey=fieldKey.stream().filter(i->!StringUtils.isEmpty(xmRptDataMap.get(i) )).collect(Collectors.toSet()); |
|||
|
|||
if(fieldKey.size()<=0) { |
|||
return failed("fieldKey-0","没有需要更新的字段"); |
|||
} |
|||
XmRptData xmRptData = fromMap(xmRptDataMap,XmRptData.class); |
|||
List<XmRptData> xmRptDatasDb=xmRptDataService.selectListByIds(ids); |
|||
if(xmRptDatasDb==null ||xmRptDatasDb.size()==0){ |
|||
return failed("data-0","记录已不存在"); |
|||
} |
|||
List<XmRptData> can=new ArrayList<>(); |
|||
List<XmRptData> no=new ArrayList<>(); |
|||
User user = LoginUtils.getCurrentUserInfo(); |
|||
for (XmRptData xmRptDataDb : xmRptDatasDb) { |
|||
Tips tips2 = new Tips("检查通过"); |
|||
if(!tips2.isOk()){ |
|||
no.add(xmRptDataDb); |
|||
}else{ |
|||
can.add(xmRptDataDb); |
|||
} |
|||
} |
|||
if(can.size()>0){ |
|||
xmRptDataMap.put("ids",can.stream().map(i->i.getId()).collect(Collectors.toList())); |
|||
xmRptDataService.editSomeFields(xmRptDataMap); |
|||
} |
|||
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 = "根据主键列表批量删除xm_rpt_data信息",notes=" ") |
|||
@ApiResponses({ |
|||
@ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") |
|||
}) |
|||
@RequestMapping(value="/batchDel",method=RequestMethod.POST) |
|||
public Map<String,Object> batchDelXmRptData(@RequestBody List<XmRptData> xmRptDatas) { |
|||
Map<String,Object> m = new HashMap<>(); |
|||
Tips tips=new Tips("成功删除"); |
|||
try{ |
|||
if(xmRptDatas.size()<=0){ |
|||
return failed("data-0","请上送待删除数据列表"); |
|||
} |
|||
List<XmRptData> datasDb=xmRptDataService.selectListByIds(xmRptDatas.stream().map(i-> i.getId() ).collect(Collectors.toList())); |
|||
|
|||
List<XmRptData> can=new ArrayList<>(); |
|||
List<XmRptData> no=new ArrayList<>(); |
|||
for (XmRptData data : datasDb) { |
|||
if(true){ |
|||
can.add(data); |
|||
}else{ |
|||
no.add(data); |
|||
} |
|||
} |
|||
List<String> msgs=new ArrayList<>(); |
|||
if(can.size()>0){ |
|||
xmRptDataService.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,65 @@ |
|||
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> |
|||
* 实体 XmRptData所有属性名: <br> |
|||
* "cfgId","报表配置主键","id","报表主键","rptName","报表名称","rptData","报表数据json对象,比rptCfg.cfg多了rawDatas","cuserid","创建人编号","cbranchId","创建人机构号","cusername","创建人名称","ctime","创建日期","bizDate","归属业务日期yyyy-MM-dd型","bizType","业务类型,同rpt_config.biz_type";<br> |
|||
* 当前主键(包括多主键):<br> |
|||
* id;<br> |
|||
*/ |
|||
@Data |
|||
@ApiModel(description="xm_rpt_data") |
|||
public class XmRptData 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 cfgId; |
|||
|
|||
@ApiModelProperty(notes="报表名称",allowEmptyValue=true,example="",allowableValues="") |
|||
String rptName; |
|||
|
|||
@ApiModelProperty(notes="报表数据json对象,比rptCfg.cfg多了rawDatas",allowEmptyValue=true,example="",allowableValues="") |
|||
String rptData; |
|||
|
|||
@ApiModelProperty(notes="创建人编号",allowEmptyValue=true,example="",allowableValues="") |
|||
String cuserid; |
|||
|
|||
@ApiModelProperty(notes="创建人机构号",allowEmptyValue=true,example="",allowableValues="") |
|||
String cbranchId; |
|||
|
|||
@ApiModelProperty(notes="创建人名称",allowEmptyValue=true,example="",allowableValues="") |
|||
String cusername; |
|||
|
|||
@ApiModelProperty(notes="创建日期",allowEmptyValue=true,example="",allowableValues="") |
|||
Date ctime; |
|||
|
|||
@ApiModelProperty(notes="归属业务日期yyyy-MM-dd型",allowEmptyValue=true,example="",allowableValues="") |
|||
String bizDate; |
|||
|
|||
@ApiModelProperty(notes="业务类型,同rpt_config.biz_type",allowEmptyValue=true,example="",allowableValues="") |
|||
String bizType; |
|||
|
|||
/** |
|||
*报表主键 |
|||
**/ |
|||
public XmRptData(String id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
/** |
|||
* xm_rpt_data |
|||
**/ |
|||
public XmRptData() { |
|||
} |
|||
|
|||
} |
|||
@ -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.XmRptData; |
|||
/** |
|||
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br> |
|||
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> |
|||
* 实体 XmRptData 表 xm_rpt_data 当前主键(包括多主键): id; |
|||
***/ |
|||
@Service("xm.core.xmRptDataService") |
|||
public class XmRptDataService extends BaseService { |
|||
static Logger logger =LoggerFactory.getLogger(XmRptDataService.class); |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,196 @@ |
|||
<?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.XmRptData"> |
|||
|
|||
|
|||
<!--开始 自定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_rpt_data res |
|||
<where> |
|||
<include refid="whereForMap"/> |
|||
<include refid="where"/> |
|||
</where> |
|||
</select> |
|||
|
|||
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> --> |
|||
<select id="selectListByWhere" parameterType="com.xm.core.entity.XmRptData" resultType="com.xm.core.entity.XmRptData"> |
|||
select * from xm_rpt_data res |
|||
<where> |
|||
<include refid="where"/> |
|||
</where> |
|||
</select> |
|||
|
|||
<!-- 通过主键查询获取数据对象 返回object --> |
|||
<select id="selectOneObject" parameterType="com.xm.core.entity.XmRptData" resultType="com.xm.core.entity.XmRptData"> |
|||
select * from xm_rpt_data res |
|||
where |
|||
res.id = #{id} |
|||
</select> |
|||
<select id="selectListByIds" parameterType="List" resultType="com.xm.core.entity.XmRptData"> |
|||
select * from xm_rpt_data 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_rpt_data res |
|||
where |
|||
res.id = #{id} |
|||
</select> |
|||
<!-- 获取数据条目 返回long --> |
|||
<select id="countByWhere" parameterType="com.xm.core.entity.XmRptData" resultType="long"> |
|||
select count(*) from xm_rpt_data res |
|||
<where> |
|||
<include refid="where"/> |
|||
</where> |
|||
</select> |
|||
<!-- 新增一条记录 主键id,--> |
|||
<insert id="insert" parameterType="com.xm.core.entity.XmRptData" useGeneratedKeys="false" keyProperty="id"> |
|||
insert into xm_rpt_data( |
|||
<include refid="columns"/> |
|||
) values ( |
|||
#{cfgId},#{id},#{rptName},#{rptData},#{cuserid},#{cbranchId},#{cusername},#{ctime},#{bizDate},#{bizType} |
|||
) |
|||
</insert> |
|||
|
|||
<!-- 按条件删除若干条记录--> |
|||
<delete id="deleteByWhere" parameterType="com.xm.core.entity.XmRptData"> |
|||
delete from xm_rpt_data res |
|||
<where> |
|||
<include refid="where"/> |
|||
</where> |
|||
</delete> |
|||
|
|||
<!-- 按主键删除一条记录--> |
|||
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmRptData"> |
|||
delete from xm_rpt_data |
|||
where id = #{id} |
|||
</delete> |
|||
|
|||
<!-- 根据条件修改若干条记录 --> |
|||
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmRptData"> |
|||
update xm_rpt_data |
|||
<set> |
|||
<include refid="someFieldSet"/> |
|||
</set> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<!-- 根据主键修改一条记录 --> |
|||
<update id="updateByPk" parameterType="com.xm.core.entity.XmRptData"> |
|||
update xm_rpt_data |
|||
<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_rpt_data |
|||
set |
|||
<include refid="batchSet"/> |
|||
where id = #{item.id} |
|||
</foreach> |
|||
</update> |
|||
|
|||
<!-- 批量修改某几个字段 --> |
|||
<delete id="editSomeFields" parameterType="HashMap"> |
|||
update xm_rpt_data |
|||
<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_rpt_data |
|||
where |
|||
(id) in |
|||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
|||
( #{item.id} ) |
|||
</foreach> |
|||
</delete> |
|||
|
|||
|
|||
<!--sql片段 列--> |
|||
<sql id="columns"> |
|||
cfg_id,id,rpt_name,rpt_data,cuserid,cbranch_id,cusername,ctime,biz_date,biz_type |
|||
</sql> |
|||
|
|||
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS--> |
|||
<sql id="where"> |
|||
<if test="cfgId != null and cfgId != ''"> and res.cfg_id = #{cfgId} </if> |
|||
<if test="id != null and id != ''"> and res.id = #{id} </if> |
|||
<if test="rptName != null and rptName != ''"> and res.rpt_name = #{rptName} </if> |
|||
<if test="rptData != null and rptData != ''"> and res.rpt_data = #{rptData} </if> |
|||
<if test="cuserid != null and cuserid != ''"> and res.cuserid = #{cuserid} </if> |
|||
<if test="cbranchId != null and cbranchId != ''"> and res.cbranch_id = #{cbranchId} </if> |
|||
<if test="cusername != null and cusername != ''"> and res.cusername = #{cusername} </if> |
|||
<if test="ctime != null"> and date_format(res.ctime,'%Y-%m-%d') = date_format(#{ctime},'%Y-%m-%d') </if> |
|||
<if test="bizDate != null and bizDate != ''"> and res.biz_date = #{bizDate} </if> |
|||
<if test="bizType != null and bizType != ''"> and res.biz_type = #{bizType} </if> |
|||
</sql> |
|||
<!--sql片段 更新字段 --> |
|||
<sql id="set"> |
|||
cfg_id = #{cfgId}, |
|||
rpt_name = #{rptName}, |
|||
rpt_data = #{rptData}, |
|||
cuserid = #{cuserid}, |
|||
cbranch_id = #{cbranchId}, |
|||
cusername = #{cusername}, |
|||
ctime = #{ctime}, |
|||
biz_date = #{bizDate}, |
|||
biz_type = #{bizType} |
|||
</sql> |
|||
<sql id="someFieldSet"> |
|||
<if test="cfgId != null and cfgId != ''"> cfg_id = #{cfgId}, </if> |
|||
<if test="rptName != null and rptName != ''"> rpt_name = #{rptName}, </if> |
|||
<if test="rptData != null and rptData != ''"> rpt_data = #{rptData}, </if> |
|||
<if test="cuserid != null and cuserid != ''"> cuserid = #{cuserid}, </if> |
|||
<if test="cbranchId != null and cbranchId != ''"> cbranch_id = #{cbranchId}, </if> |
|||
<if test="cusername != null and cusername != ''"> cusername = #{cusername}, </if> |
|||
<if test="ctime != null"> ctime = #{ctime}, </if> |
|||
<if test="bizDate != null and bizDate != ''"> biz_date = #{bizDate}, </if> |
|||
<if test="bizType != null and bizType != ''"> biz_type = #{bizType}, </if> |
|||
</sql> |
|||
<!--sql片段 批量更新 --> |
|||
<sql id="batchSet"> |
|||
cfg_id = #{item.cfgId}, |
|||
rpt_name = #{item.rptName}, |
|||
rpt_data = #{item.rptData}, |
|||
cuserid = #{item.cuserid}, |
|||
cbranch_id = #{item.cbranchId}, |
|||
cusername = #{item.cusername}, |
|||
ctime = #{item.ctime}, |
|||
biz_date = #{item.bizDate}, |
|||
biz_type = #{item.bizType} |
|||
</sql> |
|||
</mapper> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue