diff --git a/xm-core-ui/src/views/xm/core/xmMenuComment/XmMenuCommentEdit.vue b/xm-core-ui/src/views/xm/core/xmMenuComment/XmMenuCommentEdit.vue new file mode 100644 index 00000000..71df12c5 --- /dev/null +++ b/xm-core-ui/src/views/xm/core/xmMenuComment/XmMenuCommentEdit.vue @@ -0,0 +1,204 @@ + + + + + \ No newline at end of file diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmMenuCommentController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmMenuCommentController.java new file mode 100644 index 00000000..a3c7c67e --- /dev/null +++ b/xm-core/src/main/java/com/xm/core/ctrl/XmMenuCommentController.java @@ -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 ApiEntityParams; +import springfox.documentation.annotations.ApiIgnore; + +import com.xm.core.service.XmMenuCommentService; +import com.xm.core.entity.XmMenuComment; + +/** + * url编制采用rest风格,如对xm_menu_comment 档案评论表的操作有增删改查,对应的url分别为:
+ * 组织 com 顶级模块 xm 大模块 core 小模块
+ * 实体 XmMenuComment 表 xm_menu_comment 当前主键(包括多主键): id; + ***/ +@RestController("xm.core.xmMenuCommentController") +@RequestMapping(value="/**/core/xmMenuComment") +@Api(tags={"档案评论表操作接口"}) +public class XmMenuCommentController { + + static Logger logger =LoggerFactory.getLogger(XmMenuCommentController.class); + + @Autowired + private XmMenuCommentService xmMenuCommentService; + + + Map fieldsMap = toMap(new XmMenuComment()); + + + @ApiOperation( value = "查询档案评论表信息列表",notes=" ") + @ApiEntityParams( XmMenuComment.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=XmMenuComment.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") + }) + @RequestMapping(value="/list",method=RequestMethod.GET) + public Map listXmMenuComment( @ApiIgnore @RequestParam Map xmMenuComment){ + Map m = new HashMap<>(); + Tips tips=new Tips("查询成功"); + RequestUtils.transformArray(xmMenuComment, "ids"); + PageUtils.startPage(xmMenuComment); + List> xmMenuCommentList = xmMenuCommentService.selectListMapByWhere(xmMenuComment); //列出XmMenuComment列表 + PageUtils.responePage(m, xmMenuCommentList); + m.put("data",xmMenuCommentList); + + m.put("tips", tips); + return m; + } + + + + /** + @ApiOperation( value = "新增一条档案评论表信息",notes=" ") + @ApiResponses({ + @ApiResponse(code = 200,response=XmMenuComment.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") + }) + @RequestMapping(value="/add",method=RequestMethod.POST) + public Map addXmMenuComment(@RequestBody XmMenuComment xmMenuComment) { + Map m = new HashMap<>(); + Tips tips=new Tips("成功新增一条数据"); + try{ + boolean createPk=false; + if(!StringUtils.hasText(xmMenuComment.getId())) { + createPk=true; + xmMenuComment.setId(xmMenuCommentService.createKey("id")); + } + if(createPk==false){ + if(xmMenuCommentService.selectOneObject(xmMenuComment) !=null ){ + return failed("pk-exists","编号重复,请修改编号再提交"); + } + } + xmMenuCommentService.insert(xmMenuComment); + m.put("data",xmMenuComment); + }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 delXmMenuComment(@RequestBody XmMenuComment xmMenuComment){ + Map m = new HashMap<>(); + Tips tips=new Tips("成功删除一条数据"); + try{ + if(!StringUtils.hasText(xmMenuComment.getId())) { + return failed("pk-not-exists","请上送主键参数id"); + } + XmMenuComment xmMenuCommentDb = xmMenuCommentService.selectOneObject(xmMenuComment); + if( xmMenuCommentDb == null ){ + return failed("data-not-exists","数据不存在,无法删除"); + } + xmMenuCommentService.deleteByPk(xmMenuComment); + }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=XmMenuComment.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") + }) + @RequestMapping(value="/edit",method=RequestMethod.POST) + public Map editXmMenuComment(@RequestBody XmMenuComment xmMenuComment) { + Map m = new HashMap<>(); + Tips tips=new Tips("成功更新一条数据"); + try{ + if(!StringUtils.hasText(xmMenuComment.getId())) { + return failed("pk-not-exists","请上送主键参数id"); + } + XmMenuComment xmMenuCommentDb = xmMenuCommentService.selectOneObject(xmMenuComment); + if( xmMenuCommentDb == null ){ + return failed("data-not-exists","数据不存在,无法修改"); + } + xmMenuCommentService.updateSomeFieldByPk(xmMenuComment); + m.put("data",xmMenuComment); + }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 = XmMenuComment.class, props={ }, remark = "档案评论表", paramType = "body" ) + @ApiResponses({ + @ApiResponse(code = 200,response=XmMenuComment.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") + }) + @RequestMapping(value="/editSomeFields",method=RequestMethod.POST) + public Map editSomeFields( @ApiIgnore @RequestBody Map xmMenuCommentMap) { + Map m = new HashMap<>(); + Tips tips=new Tips("成功更新一条数据"); + try{ + List ids= (List) xmMenuCommentMap.get("ids"); + if(ids==null || ids.size()==0){ + return failed("ids-0","ids不能为空"); + } + + Set fields=new HashSet<>(); + fields.add("id"); + for (String fieldName : xmMenuCommentMap.keySet()) { + if(fields.contains(fieldName)){ + return failed(fieldName+"-no-edit",fieldName+"不允许修改"); + } + } + Set fieldKey=xmMenuCommentMap.keySet().stream().filter(i-> fieldsMap.containsKey(i)).collect(Collectors.toSet()); + fieldKey=fieldKey.stream().filter(i->!StringUtils.isEmpty(xmMenuCommentMap.get(i) )).collect(Collectors.toSet()); + + if(fieldKey.size()<=0) { + return failed("fieldKey-0","没有需要更新的字段"); + } + XmMenuComment xmMenuComment = fromMap(xmMenuCommentMap,XmMenuComment.class); + List xmMenuCommentsDb=xmMenuCommentService.selectListByIds(ids); + if(xmMenuCommentsDb==null ||xmMenuCommentsDb.size()==0){ + return failed("data-0","记录已不存在"); + } + List can=new ArrayList<>(); + List no=new ArrayList<>(); + User user = LoginUtils.getCurrentUserInfo(); + for (XmMenuComment xmMenuCommentDb : xmMenuCommentsDb) { + Tips tips2 = new Tips("检查通过"); + if(!tips2.isOk()){ + no.add(xmMenuCommentDb); + }else{ + can.add(xmMenuCommentDb); + } + } + if(can.size()>0){ + xmMenuCommentMap.put("ids",can.stream().map(i->i.getId()).collect(Collectors.toList())); + xmMenuCommentService.editSomeFields(xmMenuCommentMap); + } + List 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 batchDelXmMenuComment(@RequestBody List xmMenuComments) { + Map m = new HashMap<>(); + Tips tips=new Tips("成功删除"); + try{ + if(xmMenuComments.size()<=0){ + return failed("data-0","请上送待删除数据列表"); + } + List datasDb=xmMenuCommentService.selectListByIds(xmMenuComments.stream().map(i-> i.getId() ).collect(Collectors.toList())); + + List can=new ArrayList<>(); + List no=new ArrayList<>(); + for (XmMenuComment data : datasDb) { + if(true){ + can.add(data); + }else{ + no.add(data); + } + } + List msgs=new ArrayList<>(); + if(can.size()>0){ + xmMenuCommentService.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; + } + */ +} diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmQuestionController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmQuestionController.java index a77a5226..795c2b4e 100644 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmQuestionController.java +++ b/xm-core/src/main/java/com/xm/core/ctrl/XmQuestionController.java @@ -322,6 +322,7 @@ public class XmQuestionController { } xmQuestionService.editSomeFields(xmQuestionMap); String remarks= (String) xmQuestionMap.get("remarks"); + String description= (String) xmQuestionMap.get("description"); String handlerUsername= (String) xmQuestionMap.get("handlerUsername"); String bugStatus= (String) xmQuestionMap.get("bugStatus"); @@ -342,8 +343,10 @@ public class XmQuestionController { }else if(StringUtils.hasText(bugStatus)){ handle.setReceiptMessage(user.getUsername()+"将缺陷状态改为"+bugStatus); + }else if(StringUtils.hasText(description)){ + handle.setReceiptMessage(user.getUsername()+"修改了缺陷描述:"+description); }else{ - handle.setReceiptMessage(user.getUsername()+"修改了缺陷信息"+map.toString()); + handle.setReceiptMessage(user.getUsername()+"修改了缺陷信息:"+map.toString()); } handle.setHandleStatus(xmQuestionVo.getBugStatus()); diff --git a/xm-core/src/main/java/com/xm/core/entity/XmMenuComment.java b/xm-core/src/main/java/com/xm/core/entity/XmMenuComment.java new file mode 100644 index 00000000..5aad39f4 --- /dev/null +++ b/xm-core/src/main/java/com/xm/core/entity/XmMenuComment.java @@ -0,0 +1,93 @@ +package com.xm.core.entity; + +import lombok.Data; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; +import java.math.BigDecimal; + +/** + * 组织 com 顶级模块 xm 大模块 core 小模块
+ * 实体 XmMenuComment所有属性名:
+ * "id","主键","userid","评论人","username","评论人姓名","star","星级","cdate","时间","menuId","需求编号","pid","上级评论","ups","点赞数量","isShow","是否显示0否1是","toUserid","回复用户编号","toUsername","回复用户名","lvl","层级0,1,2,3,4","context","评论内容","branchId","机构编号","ip","ip地址","cityId","城市编号","cityName","城市名称","status","状态0未审核,1已审核,3审核不通过","childNums","儿子节点数量";
+ * 当前主键(包括多主键):
+ * id;
+ */ + @Data +@ApiModel(description="档案评论表") +public class XmMenuComment 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 userid; + + @ApiModelProperty(notes="评论人姓名",allowEmptyValue=true,example="",allowableValues="") + String username; + + @ApiModelProperty(notes="星级",allowEmptyValue=true,example="",allowableValues="") + String star; + + @ApiModelProperty(notes="时间",allowEmptyValue=true,example="",allowableValues="") + Date cdate; + + @ApiModelProperty(notes="需求编号",allowEmptyValue=true,example="",allowableValues="") + String menuId; + + @ApiModelProperty(notes="上级评论",allowEmptyValue=true,example="",allowableValues="") + String pid; + + @ApiModelProperty(notes="点赞数量",allowEmptyValue=true,example="",allowableValues="") + BigDecimal ups; + + @ApiModelProperty(notes="是否显示0否1是",allowEmptyValue=true,example="",allowableValues="") + String isShow; + + @ApiModelProperty(notes="回复用户编号",allowEmptyValue=true,example="",allowableValues="") + String toUserid; + + @ApiModelProperty(notes="回复用户名",allowEmptyValue=true,example="",allowableValues="") + String toUsername; + + @ApiModelProperty(notes="层级0,1,2,3,4",allowEmptyValue=true,example="",allowableValues="") + String lvl; + + @ApiModelProperty(notes="评论内容",allowEmptyValue=true,example="",allowableValues="") + String context; + + @ApiModelProperty(notes="机构编号",allowEmptyValue=true,example="",allowableValues="") + String branchId; + + @ApiModelProperty(notes="ip地址",allowEmptyValue=true,example="",allowableValues="") + String ip; + + @ApiModelProperty(notes="城市编号",allowEmptyValue=true,example="",allowableValues="") + String cityId; + + @ApiModelProperty(notes="城市名称",allowEmptyValue=true,example="",allowableValues="") + String cityName; + + @ApiModelProperty(notes="状态0未审核,1已审核,3审核不通过",allowEmptyValue=true,example="",allowableValues="") + String status; + + @ApiModelProperty(notes="儿子节点数量",allowEmptyValue=true,example="",allowableValues="") + Integer childNums; + + /** + *主键 + **/ + public XmMenuComment(String id) { + this.id = id; + } + + /** + * 档案评论表 + **/ + public XmMenuComment() { + } + +} \ No newline at end of file diff --git a/xm-core/src/main/java/com/xm/core/service/XmMenuCommentService.java b/xm-core/src/main/java/com/xm/core/service/XmMenuCommentService.java new file mode 100644 index 00000000..686ac94a --- /dev/null +++ b/xm-core/src/main/java/com/xm/core/service/XmMenuCommentService.java @@ -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.XmMenuComment; +/** + * 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.
+ * 组织 com 顶级模块 xm 大模块 core 小模块
+ * 实体 XmMenuComment 表 xm_menu_comment 当前主键(包括多主键): id; + ***/ +@Service("xm.core.xmMenuCommentService") +public class XmMenuCommentService extends BaseService { + static Logger logger =LoggerFactory.getLogger(XmMenuCommentService.class); + +} + diff --git a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmMenuCommentMapper.xml b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmMenuCommentMapper.xml new file mode 100644 index 00000000..c640208d --- /dev/null +++ b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmMenuCommentMapper.xml @@ -0,0 +1,232 @@ + + + + + + + + + and (res.id) in + + ( #{item}) + + + + + + + + + + + + + + + + + + + + + + + + + + insert into xm_menu_comment( + + ) values ( + #{id},#{userid},#{username},#{star},#{cdate},#{menuId},#{pid},#{ups},#{isShow},#{toUserid},#{toUsername},#{lvl},#{context},#{branchId},#{ip},#{cityId},#{cityName},#{status},#{childNums} + ) + + + + + delete from xm_menu_comment res + + + + + + + + delete from xm_menu_comment + where id = #{id} + + + + + update xm_menu_comment + + + + where id = #{id} + + + + + update xm_menu_comment + + + + where id = #{id} + + + + + + + + update xm_menu_comment + set + + where id = #{item.id} + + + + + + update xm_menu_comment + + + + where (id) in + + ( #{item}) + + + + + delete from xm_menu_comment + where + (id) in + + ( #{item.id} ) + + + + + + + id,userid,username,star,cdate,menu_id,pid,ups,is_show,to_userid,to_username,lvl,context,branch_id,ip,city_id,city_name,status,child_nums + + + + + and res.id = #{id} + and res.userid = #{userid} + and res.username = #{username} + and res.star = #{star} + and date_format(res.cdate,'%Y-%m-%d') = date_format(#{cdate},'%Y-%m-%d') + and res.menu_id = #{menuId} + and res.pid = #{pid} + and res.ups = #{ups} + and res.is_show = #{isShow} + and res.to_userid = #{toUserid} + and res.to_username = #{toUsername} + and res.lvl = #{lvl} + and res.context = #{context} + and res.branch_id = #{branchId} + and res.ip = #{ip} + and res.city_id = #{cityId} + and res.city_name = #{cityName} + and res.status = #{status} + and res.child_nums = #{childNums} + + + + userid = #{userid}, + username = #{username}, + star = #{star}, + cdate = #{cdate}, + menu_id = #{menuId}, + pid = #{pid}, + ups = #{ups}, + is_show = #{isShow}, + to_userid = #{toUserid}, + to_username = #{toUsername}, + lvl = #{lvl}, + context = #{context}, + branch_id = #{branchId}, + ip = #{ip}, + city_id = #{cityId}, + city_name = #{cityName}, + status = #{status}, + child_nums = #{childNums} + + + userid = #{userid}, + username = #{username}, + star = #{star}, + cdate = #{cdate}, + menu_id = #{menuId}, + pid = #{pid}, + ups = #{ups}, + is_show = #{isShow}, + to_userid = #{toUserid}, + to_username = #{toUsername}, + lvl = #{lvl}, + context = #{context}, + branch_id = #{branchId}, + ip = #{ip}, + city_id = #{cityId}, + city_name = #{cityName}, + status = #{status}, + child_nums = #{childNums}, + + + + userid = #{item.userid}, + username = #{item.username}, + star = #{item.star}, + cdate = #{item.cdate}, + menu_id = #{item.menuId}, + pid = #{item.pid}, + ups = #{item.ups}, + is_show = #{item.isShow}, + to_userid = #{item.toUserid}, + to_username = #{item.toUsername}, + lvl = #{item.lvl}, + context = #{item.context}, + branch_id = #{item.branchId}, + ip = #{item.ip}, + city_id = #{item.cityId}, + city_name = #{item.cityName}, + status = #{item.status}, + child_nums = #{item.childNums} + + \ No newline at end of file