Commit 7dbacaec00252652a87dfc835c777bd7f687cfda
1 parent
50d212e234
Exists in
master
and in
1 other branch
update
Showing 5 changed files with 49 additions and 19 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/annotation/LogAnnotation.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/aop/CrudCommandAop.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DepartController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/HospitalController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsLogsController.java
talkonlineweb/src/main/java/com/lyms/talkonlineweb/annotation/LogAnnotation.java
View file @
7dbacae
talkonlineweb/src/main/java/com/lyms/talkonlineweb/aop/CrudCommandAop.java
View file @
7dbacae
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DepartController.java
View file @
7dbacae
| 1 | 1 | package com.lyms.talkonlineweb.controller; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
| 3 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 4 | 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 5 | 6 | import com.lyms.talkonlineweb.domain.*; |
| 6 | 7 | import com.lyms.talkonlineweb.result.BaseResponse; |
| 7 | -import com.lyms.talkonlineweb.service.HdepartInfoService; | |
| 8 | -import com.lyms.talkonlineweb.service.LymsDepartillService; | |
| 9 | -import com.lyms.talkonlineweb.service.LymsHdepartService; | |
| 10 | -import com.lyms.talkonlineweb.service.LymsIllnessService; | |
| 8 | +import com.lyms.talkonlineweb.service.*; | |
| 11 | 9 | import com.lyms.talkonlineweb.util.Constant; |
| 12 | 10 | import com.lyms.talkonlineweb.util.JwtUtils; |
| 13 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | 12 | |
| ... | ... | @@ -36,7 +34,10 @@ |
| 36 | 34 | @Autowired |
| 37 | 35 | private HdepartInfoService hdepartInfoService; |
| 38 | 36 | |
| 37 | + @Autowired | |
| 38 | + private LymsLogsCrudService lymsLogsCrudService; | |
| 39 | 39 | |
| 40 | + | |
| 40 | 41 | /** |
| 41 | 42 | * 获取科室列表 |
| 42 | 43 | * @param depart |
| 43 | 44 | |
| ... | ... | @@ -83,11 +84,14 @@ |
| 83 | 84 | public BaseResponse saveDepart(@RequestBody LymsHdepart depart, BindingResult result){ |
| 84 | 85 | BaseResponse baseResponse=new BaseResponse(); |
| 85 | 86 | baseResponse.setErrormsg(""); |
| 87 | + //操作记录标识 | |
| 88 | + Integer hid=0; | |
| 86 | 89 | if(depart.getDid()==null){ |
| 87 | 90 | depart.setCreatedtime(new Date()); |
| 88 | 91 | LymsHdepart depart2=new LymsHdepart(); |
| 89 | 92 | |
| 90 | 93 | }else{ |
| 94 | + hid=1; | |
| 91 | 95 | depart.setUpdatedTime(new Date()); |
| 92 | 96 | } |
| 93 | 97 | if(result.hasErrors()){ |
| ... | ... | @@ -115,6 +119,8 @@ |
| 115 | 119 | departill.setIid(Integer.parseInt(iArr[i])); |
| 116 | 120 | lymsDepartillService.save(departill); |
| 117 | 121 | } |
| 122 | + //保存操作记录 | |
| 123 | + lymsLogsCrud(depart,hid); | |
| 118 | 124 | |
| 119 | 125 | baseResponse.setErrorcode(f==true?0:1); |
| 120 | 126 | return baseResponse; |
| 121 | 127 | |
| ... | ... | @@ -128,7 +134,13 @@ |
| 128 | 134 | @GetMapping("delDepart") |
| 129 | 135 | public BaseResponse delHosp(int did){ |
| 130 | 136 | BaseResponse baseResponse=new BaseResponse(); |
| 137 | + //操作记保存参数 | |
| 138 | + LymsHdepart depart=lymsHdepartService.getById(did); | |
| 139 | + | |
| 131 | 140 | boolean f=lymsHdepartService.removeById(did); |
| 141 | + //保存操作记录 | |
| 142 | + lymsLogsCrud(depart,null); | |
| 143 | + | |
| 132 | 144 | baseResponse.setErrorcode(f==true?0:1); |
| 133 | 145 | return baseResponse; |
| 134 | 146 | } |
| ... | ... | @@ -155,6 +167,27 @@ |
| 155 | 167 | // } |
| 156 | 168 | |
| 157 | 169 | return baseResponse; |
| 170 | + } | |
| 171 | + | |
| 172 | + | |
| 173 | + /** | |
| 174 | + * 操作记录 | |
| 175 | + * @param depart | |
| 176 | + * @param hid | |
| 177 | + */ | |
| 178 | + public void lymsLogsCrud(LymsHdepart depart,Integer hid){ | |
| 179 | + LymsLogsCrud lymsLogsCrud=new LymsLogsCrud(); | |
| 180 | + if(null!=hid){ | |
| 181 | + lymsLogsCrud.setCrudtype(hid==1?"新增科室":"编辑科室"); | |
| 182 | + }else { | |
| 183 | + lymsLogsCrud.setCrudtype("删除科室"); | |
| 184 | + } | |
| 185 | + lymsLogsCrud.setUname(depart.getCreator()); | |
| 186 | + lymsLogsCrud.setHname(depart.getHname()); | |
| 187 | + lymsLogsCrud.setHdname(depart.getDname()); | |
| 188 | + lymsLogsCrud.setCreatdata(new Date()); | |
| 189 | + lymsLogsCrudService.save(lymsLogsCrud); | |
| 190 | + | |
| 158 | 191 | } |
| 159 | 192 | |
| 160 | 193 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/HospitalController.java
View file @
7dbacae
| ... | ... | @@ -112,7 +112,6 @@ |
| 112 | 112 | @PostMapping("saveHosp") |
| 113 | 113 | public BaseResponse saveHosp(@RequestBody LymsHospital hospital){ |
| 114 | 114 | BaseResponse baseResponse=new BaseResponse(); |
| 115 | - | |
| 116 | 115 | if(hospital.getHid()==null){ |
| 117 | 116 | hospital.setCreatedtime(new Date()); |
| 118 | 117 | }else{ |
| ... | ... | @@ -120,14 +119,6 @@ |
| 120 | 119 | } |
| 121 | 120 | boolean f=lymsHospitalService.saveOrUpdate(hospital); |
| 122 | 121 | |
| 123 | - //操作记录 | |
| 124 | - LymsLogsCrud lymsLogsCrud=new LymsLogsCrud(); | |
| 125 | - lymsLogsCrud.setUname(hospital.getCreator()); | |
| 126 | - lymsLogsCrud.setCrudtype(hospital.getHid()==null?"新增医院":"编辑医院"); | |
| 127 | - lymsLogsCrud.setHname(hospital.getHname()); | |
| 128 | - lymsLogsCrud.setCreatdata(new Date()); | |
| 129 | - lymsLogsCrudService.save(lymsLogsCrud); | |
| 130 | - | |
| 131 | 122 | baseResponse.setErrorcode(f==true?0:1); |
| 132 | 123 | return baseResponse; |
| 133 | 124 | } |
| ... | ... | @@ -141,7 +132,6 @@ |
| 141 | 132 | public BaseResponse delHosp(int hid){ |
| 142 | 133 | BaseResponse baseResponse=new BaseResponse(); |
| 143 | 134 | boolean f=lymsHospitalService.removeById(hid); |
| 144 | - | |
| 145 | 135 | baseResponse.setErrorcode(f==true?0:1); |
| 146 | 136 | return baseResponse; |
| 147 | 137 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsLogsController.java
View file @
7dbacae
| ... | ... | @@ -23,11 +23,17 @@ |
| 23 | 23 | * @return |
| 24 | 24 | */ |
| 25 | 25 | @GetMapping("logscrud") |
| 26 | - public BaseResponse logscrud(LymsLogsCrud lymsLogsCrud, int current, int size){ | |
| 26 | + public BaseResponse logscrud(LymsLogsCrud lymsLogsCrud, Integer current, Integer size){ | |
| 27 | 27 | BaseResponse baseResponse=new BaseResponse(); |
| 28 | - Page<LymsLogsCrud> page=new Page<>(current,size); | |
| 29 | - Page<LymsLogsCrud> lymsLogsCrudPage=lymsLogsCrudService.page(page,Wrappers.query(lymsLogsCrud).orderByDesc("creatdata")); | |
| 30 | - baseResponse.setObject(lymsLogsCrudPage); | |
| 28 | + try { | |
| 29 | + Page<LymsLogsCrud> page=new Page<>(null==current?1:current,null==size?20:size); | |
| 30 | + Page<LymsLogsCrud> lymsLogsCrudPage=lymsLogsCrudService.page(page,Wrappers.query(lymsLogsCrud).orderByDesc("creatdata")); | |
| 31 | + baseResponse.setObject(lymsLogsCrudPage); | |
| 32 | + baseResponse.setErrormsg("成功"); | |
| 33 | + } catch (Exception e) { | |
| 34 | + baseResponse.setErrormsg("失败"); | |
| 35 | + e.printStackTrace(); | |
| 36 | + } | |
| 31 | 37 | return baseResponse; |
| 32 | 38 | } |
| 33 | 39 | } |