Commit 0eb041245449aee8d94e563256f1e8fcc9d08cef
1 parent
9d2c048a
Exists in
dev
异动还原
Showing
7 changed files
with
278 additions
and
141 deletions
Show diff stats
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/controller/McVisitController.java
... | ... | @@ -63,6 +63,7 @@ public class McVisitController extends BaseController { |
63 | 63 | /** |
64 | 64 | * 获取拜访工单详细信息 |
65 | 65 | */ |
66 | + @Log(title = "拜访工单-获取拜访工单详细信息", businessType = BusinessType.OTHER) | |
66 | 67 | @RequirePermission(value = {"schsf:mcVisit:details", "schsf:mcVisit:list"}, logical = Logical.OR) |
67 | 68 | @GetMapping(value = "details/{id}") |
68 | 69 | public AjaxResult getInfo(@PathVariable("id") Long id) { |
... | ... | @@ -73,7 +74,7 @@ public class McVisitController extends BaseController { |
73 | 74 | * 新增拜访工单 |
74 | 75 | */ |
75 | 76 | @RequirePermission("schsf:mcVisit:add") |
76 | - @Log(title = "拜访工单", businessType = BusinessType.INSERT) | |
77 | + @Log(title = "拜访工单-新增拜访工单", businessType = BusinessType.INSERT) | |
77 | 78 | @PostMapping("/add") |
78 | 79 | public AjaxResult add(@RequestBody McVisit mcVisit) { |
79 | 80 | AjaxResult paramValidate = getMcVisitValidate(mcVisit); |
... | ... | @@ -117,7 +118,7 @@ public class McVisitController extends BaseController { |
117 | 118 | * 修改拜访工单 |
118 | 119 | */ |
119 | 120 | @RequirePermission("schsf:mcVisit:edit") |
120 | - @Log(title = "拜访工单", businessType = BusinessType.UPDATE) | |
121 | + @Log(title = "拜访工单-修改拜访工单", businessType = BusinessType.UPDATE) | |
121 | 122 | @PostMapping("/edit") |
122 | 123 | public AjaxResult edit(@RequestBody McVisit mcVisit) throws CloneNotSupportedException { |
123 | 124 | AjaxResult paramValidate = getMcVisitValidate(mcVisit); |
... | ... | @@ -131,7 +132,7 @@ public class McVisitController extends BaseController { |
131 | 132 | * status : Y :通过 N :驳回 |
132 | 133 | */ |
133 | 134 | @RequirePermission("schsf:mcVisit:ticket_submitAuditOne") |
134 | - @Log(title = "拜访工单", businessType = BusinessType.INSERT) | |
135 | + @Log(title = "拜访工单-发布-一级审核", businessType = BusinessType.UPDATE) | |
135 | 136 | @PostMapping("/ticket/submitAuditOne") |
136 | 137 | public AjaxResult ticketSubmitAuditOne(@Validated @RequestBody McVisitAuditVo mcVisitAuditVo) throws CloneNotSupportedException { |
137 | 138 | mcVisitAuditVo.setType("1"); |
... | ... | @@ -144,7 +145,7 @@ public class McVisitController extends BaseController { |
144 | 145 | * status : Y :通过 N :驳回 |
145 | 146 | */ |
146 | 147 | @RequirePermission("schsf:mcVisit:ticket_submitAuditTwo") |
147 | - @Log(title = "拜访工单", businessType = BusinessType.INSERT) | |
148 | + @Log(title = "拜访工单-发布-二级审核", businessType = BusinessType.UPDATE) | |
148 | 149 | @PostMapping("/ticket/submitAuditTwo") |
149 | 150 | public AjaxResult ticketsubmitAuditTwo(@Validated @RequestBody McVisitAuditVo mcVisitAuditVo) throws CloneNotSupportedException { |
150 | 151 | mcVisitAuditVo.setType("2"); |
... | ... | @@ -158,9 +159,9 @@ public class McVisitController extends BaseController { |
158 | 159 | * status : Y :通过 N :驳回 |
159 | 160 | */ |
160 | 161 | @RequirePermission("schsf:mcVisit:modification_submitAuditOne") |
161 | - @Log(title = "拜访工单", businessType = BusinessType.INSERT) | |
162 | + @Log(title = "拜访工单-异动-一级审核", businessType = BusinessType.INSERT) | |
162 | 163 | @PostMapping("/modification/submitAuditOne") |
163 | - public AjaxResult modificationSubmitAuditOne(@Validated @RequestBody McVisitAuditVo mcVisitAuditVo) throws CloneNotSupportedException { | |
164 | + public AjaxResult modificationSubmitAuditOne(@Validated @RequestBody McVisitAuditVo mcVisitAuditVo) throws Exception { | |
164 | 165 | mcVisitAuditVo.setType("3"); |
165 | 166 | mcVisitService.SubmitAudit(mcVisitAuditVo); |
166 | 167 | return AjaxResult.success(); |
... | ... | @@ -171,7 +172,7 @@ public class McVisitController extends BaseController { |
171 | 172 | * status : Y :通过 N :驳回 |
172 | 173 | */ |
173 | 174 | @RequirePermission("schsf:mcVisit:modification_submitAuditTwo") |
174 | - @Log(title = "拜访工单", businessType = BusinessType.INSERT) | |
175 | + @Log(title = "拜访工单-异动-二级审核", businessType = BusinessType.INSERT) | |
175 | 176 | @PostMapping("/modification/submitAuditTwo") |
176 | 177 | public AjaxResult modificationSubmitAuditTwo(@Validated @RequestBody McVisitAuditVo mcVisitAuditVo) throws CloneNotSupportedException { |
177 | 178 | mcVisitAuditVo.setType("4"); |
... | ... | @@ -188,35 +189,21 @@ public class McVisitController extends BaseController { |
188 | 189 | * @throws CloneNotSupportedException |
189 | 190 | */ |
190 | 191 | @RequirePermission("schsf:mcVisit:modification") |
191 | - @Log(title = "拜访工单", businessType = BusinessType.UPDATE) | |
192 | + @Log(title = "拜访工单-发起异动", businessType = BusinessType.UPDATE) | |
192 | 193 | @PostMapping("/modification") |
193 | 194 | public AjaxResult modification(@Validated @RequestBody McVisitModificationVo mcVisitModificationVo) throws CloneNotSupportedException { |
194 | -// McVisit mcVisit = new McVisit(); | |
195 | -// mcVisit.setId(id); | |
196 | -// mcVisit.setUserIdCard(userIdCard); | |
197 | -// mcVisit.setInvoiceNo(invoiceNo); | |
198 | -// mcVisit.setChargeAmt(chargeAmt); | |
199 | -// mcVisit.setPaymentMeth(paymentMeth); | |
200 | -// mcVisit.setChargeType(chargeType); | |
201 | -// mcVisit.setRemark(remark); | |
202 | 195 | return toAjax(mcVisitService.updateMcVisitModification(mcVisitModificationVo)); |
203 | 196 | } |
204 | 197 | |
205 | - | |
206 | -// /** | |
207 | -// * 删除拜访工单 | |
208 | -// */ | |
209 | -// @RequirePermission("schsf:mcVisit:remove") | |
210 | -// @Log(title = "拜访工单", businessType = BusinessType.DELETE) | |
211 | -// @DeleteMapping("delete/{ids}") | |
212 | -// public AjaxResult remove(@PathVariable Long[] ids) | |
213 | -// { | |
214 | -// return toAjax(mcVisitService.deleteMcVisitByIds(ids)); | |
215 | -// } | |
216 | - | |
217 | - | |
198 | + /** | |
199 | + * | |
200 | + * 作废工作单 | |
201 | + * @param mcVisit | |
202 | + * @return | |
203 | + * @throws CloneNotSupportedException | |
204 | + */ | |
218 | 205 | @RequirePermission("schsf:mcVisit:cancel") |
219 | - @Log(title = "拜访工单", businessType = BusinessType.DELETE) | |
206 | + @Log(title = "拜访工单-作废工作单", businessType = BusinessType.DELETE) | |
220 | 207 | @PostMapping("/cancel") |
221 | 208 | public AjaxResult cancel(@RequestBody McVisit mcVisit) throws CloneNotSupportedException { |
222 | 209 | return toAjax(mcVisitService.updateMcVisitCancel(mcVisit.getId(), mcVisit.getRemark())); | ... | ... |
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/mapper/McOperationLogMapper.java
... | ... | @@ -32,4 +32,7 @@ public interface McOperationLogMapper |
32 | 32 | |
33 | 33 | List<String> getUserMenuPermsByRoles(@Param("userId") String userId,@Param("menuPerms") String menuPerms,@Param("dataId") String dataId); |
34 | 34 | |
35 | + McOperationLog selectMcOperationLogNewYdById(McOperationLog mcOperationLog); | |
36 | + | |
37 | + | |
35 | 38 | } | ... | ... |
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/service/IMcOperationLogService.java
... | ... | @@ -21,4 +21,12 @@ public interface IMcOperationLogService |
21 | 21 | public List<McOperationLog> selectMcOperationLogList(McOperationLog mcOperationLog); |
22 | 22 | |
23 | 23 | public int insertMcOperationLog(String dataForm, Long dataId,String menuCode, String opName, String opType, String opRemark, String beforeDataJson, String afterDataJson); |
24 | + | |
25 | + /** | |
26 | + * 查询最新发起得异动 | |
27 | + * @param id | |
28 | + * @return | |
29 | + */ | |
30 | + McOperationLog selectMcOperationLogNewYdById(Long id); | |
31 | + | |
24 | 32 | } | ... | ... |
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/service/impl/McConstructionServiceImpl.java
... | ... | @@ -231,9 +231,9 @@ public class McConstructionServiceImpl implements IMcConstructionService { |
231 | 231 | //未完成原因 |
232 | 232 | mcConstruction_new.setGctNcmpRsn(mcConstruction_param.getGctNcmpRsn()); |
233 | 233 | |
234 | - mcConstruction_new.setProjectPersonId(userId); | |
235 | - mcConstruction_new.setProjectPersonName(userName); | |
236 | - mcConstruction_new.setProjectPersonAccount(userAccount); | |
234 | + mcConstruction_new.setOperatePersonId(userId); | |
235 | + mcConstruction_new.setOperatePersonName(userName); | |
236 | + mcConstruction_new.setOperatePersonAccount(userAccount); | |
237 | 237 | mcConstruction_new.setUpdateBy(userId.toString()); |
238 | 238 | mcConstruction_new.setUpdateTime(time); |
239 | 239 | mcConstruction_new.setStatusCode(McConstructionStatusEnums.MAINTENANCE_END.getCode()); | ... | ... |
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/service/impl/McOperationLogServiceImpl.java
... | ... | @@ -50,4 +50,13 @@ public class McOperationLogServiceImpl implements IMcOperationLogService { |
50 | 50 | return mcOperationLogMapper.insertMcOperationLog(mcOperationLog); |
51 | 51 | } |
52 | 52 | |
53 | + @Override | |
54 | + public McOperationLog selectMcOperationLogNewYdById(Long id) { | |
55 | + McOperationLog mcOperationLog = new McOperationLog(); | |
56 | + mcOperationLog.setDataId(id); | |
57 | + mcOperationLog.setOpType("2"); | |
58 | + mcOperationLog.setOpName("发起异动"); | |
59 | + return mcOperationLogMapper.selectMcOperationLogNewYdById(mcOperationLog); | |
60 | + } | |
61 | + | |
53 | 62 | } | ... | ... |
zr-cloud/zr-modules/zr-schsf/src/main/java/com/chinagas/modules/schsf/service/impl/McVisitServiceImpl.java
... | ... | @@ -2,12 +2,13 @@ package com.chinagas.modules.schsf.service.impl; |
2 | 2 | |
3 | 3 | import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import com.alibaba.fastjson2.JSON; |
5 | +import com.alibaba.fastjson2.JSONObject; | |
5 | 6 | import com.chinagas.api.system.domain.SysUser; |
6 | 7 | import com.chinagas.common.core.utils.DateUtils; |
7 | 8 | import com.chinagas.common.core.utils.StringUtils; |
8 | 9 | import com.chinagas.common.datascope.annotation.DataScope; |
9 | 10 | import com.chinagas.common.security.utils.SecurityUtils; |
10 | -import com.chinagas.modules.schsf.domain.McIgnition; | |
11 | +import com.chinagas.modules.schsf.domain.McOperationLog; | |
11 | 12 | import com.chinagas.modules.schsf.domain.McVisit; |
12 | 13 | import com.chinagas.modules.schsf.domain.McVisitStatusNodeInfo; |
13 | 14 | import com.chinagas.modules.schsf.domain.vo.McVisitAuditVo; |
... | ... | @@ -20,6 +21,8 @@ import com.chinagas.modules.schsf.service.IMcOperationLogService; |
20 | 21 | import com.chinagas.modules.schsf.service.IMcVisitService; |
21 | 22 | import com.chinagas.modules.schsf.stateMachine.StateMachineNext; |
22 | 23 | import org.jetbrains.annotations.NotNull; |
24 | +import org.slf4j.Logger; | |
25 | +import org.slf4j.LoggerFactory; | |
23 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
24 | 27 | import org.springframework.stereotype.Service; |
25 | 28 | import org.springframework.transaction.annotation.Transactional; |
... | ... | @@ -41,9 +44,10 @@ import java.util.concurrent.atomic.AtomicInteger; |
41 | 44 | * @author cw |
42 | 45 | * @date 2024-05-30 |
43 | 46 | */ |
44 | -@Transactional | |
47 | + | |
45 | 48 | @Service |
46 | 49 | public class McVisitServiceImpl implements IMcVisitService { |
50 | + private static final Logger log = LoggerFactory.getLogger(McVisitServiceImpl.class); | |
47 | 51 | @Autowired |
48 | 52 | private McVisitMapper mcVisitMapper; |
49 | 53 | @Autowired |
... | ... | @@ -127,6 +131,7 @@ public class McVisitServiceImpl implements IMcVisitService { |
127 | 131 | * @param mcVisit 拜访工单 |
128 | 132 | * @return 结果 |
129 | 133 | */ |
134 | + @Transactional | |
130 | 135 | @Override |
131 | 136 | public int insertMcVisit(McVisit mcVisit) { |
132 | 137 | |
... | ... | @@ -252,6 +257,7 @@ public class McVisitServiceImpl implements IMcVisitService { |
252 | 257 | * @param mcVisit 拜访工单 |
253 | 258 | * @return 结果 |
254 | 259 | */ |
260 | + @Transactional | |
255 | 261 | @Override |
256 | 262 | public int updateMcVisit(McVisit mcVisit_old) throws CloneNotSupportedException { |
257 | 263 | |
... | ... | @@ -282,6 +288,7 @@ public class McVisitServiceImpl implements IMcVisitService { |
282 | 288 | * @param ids 需要删除的拜访工单主键 |
283 | 289 | * @return 结果 |
284 | 290 | */ |
291 | + @Transactional | |
285 | 292 | @Override |
286 | 293 | public int deleteMcVisitByIds(Long[] ids) { |
287 | 294 | return mcVisitMapper.deleteMcVisitByIds(ids); |
... | ... | @@ -293,12 +300,13 @@ public class McVisitServiceImpl implements IMcVisitService { |
293 | 300 | * @param id 拜访工单主键 |
294 | 301 | * @return 结果 |
295 | 302 | */ |
303 | + @Transactional | |
296 | 304 | @Override |
297 | 305 | public int deleteMcVisitById(Long id) { |
298 | 306 | return mcVisitMapper.deleteMcVisitById(id); |
299 | 307 | } |
300 | 308 | |
301 | - @DataScope(deptAlias = "d", userAlias = "u") | |
309 | + @Transactional | |
302 | 310 | @Override |
303 | 311 | public void SubmitAudit(McVisitAuditVo mcVisitAuditVo) throws CloneNotSupportedException { |
304 | 312 | String status = mcVisitAuditVo.getStatus(); |
... | ... | @@ -346,6 +354,7 @@ public class McVisitServiceImpl implements IMcVisitService { |
346 | 354 | visitlsEventEnums = status.equals(YesNoEnums.Y.getName()) ? VisitlsEventEnums.MODIFICATION_1_AUDIT_YES : VisitlsEventEnums.MODIFICATION_1_AUDIT_NO; |
347 | 355 | menuCode = "schsf:mcVisit:modification_submitAuditOne"; |
348 | 356 | opType="2"; |
357 | + modificationReduction(status,mcVisit_new); | |
349 | 358 | break; |
350 | 359 | case "4": |
351 | 360 | //发布-一级审核 |
... | ... | @@ -355,6 +364,7 @@ public class McVisitServiceImpl implements IMcVisitService { |
355 | 364 | visitlsEventEnums = status.equals(YesNoEnums.Y.getName()) ? VisitlsEventEnums.MODIFICATION_2_AUDIT_YES : VisitlsEventEnums.MODIFICATION_2_AUDIT_NO; |
356 | 365 | menuCode = "schsf:mcVisit:modification_submitAuditTwo"; |
357 | 366 | opType="2"; |
367 | + modificationReduction(status,mcVisit_new); | |
358 | 368 | break; |
359 | 369 | default: |
360 | 370 | throw new RuntimeException("非法请求"); |
... | ... | @@ -366,14 +376,42 @@ public class McVisitServiceImpl implements IMcVisitService { |
366 | 376 | } |
367 | 377 | |
368 | 378 | /** |
379 | + * 异动还原 | |
380 | + * @param status | |
381 | + * @param mcVisit | |
382 | + */ | |
383 | + private void modificationReduction(String status,McVisit mcVisit) { | |
384 | + if (status.equals("N")){ | |
385 | + McOperationLog mcOperationLog=iMcOperationLogService.selectMcOperationLogNewYdById(mcVisit.getId()); | |
386 | + String beforeDataJson = mcOperationLog.getBeforeDataJson(); | |
387 | + // 1. 判断是否为有效JSON | |
388 | + try { | |
389 | + JSONObject.parseObject(beforeDataJson); | |
390 | + } catch (Exception e) { | |
391 | + throw new RuntimeException("数据还原,JSON格式无效"); | |
392 | + } | |
393 | + // 2. 转换为McVisit | |
394 | + McVisit McVisit_hy = JSON.parseObject(beforeDataJson, McVisit.class); | |
395 | + // 3. 数据还原 | |
396 | + mcVisit.setUserIdCard(McVisit_hy.getUserIdCard()); | |
397 | + mcVisit.setInvoiceNo(McVisit_hy.getInvoiceNo()); | |
398 | + mcVisit.setChargeAmt(McVisit_hy.getChargeAmt()); | |
399 | + mcVisit.setPaymentMeth(McVisit_hy.getPaymentMeth()); | |
400 | + mcVisit.setChargeType(McVisit_hy.getChargeType()); | |
401 | + mcVisit.setAttachmentFile(McVisit_hy.getAttachmentFile()); | |
402 | + } | |
403 | + } | |
404 | + | |
405 | + /** | |
369 | 406 | * 发起异动 |
370 | 407 | * @param Modification_mcVisit |
371 | 408 | * @return |
372 | 409 | * @throws CloneNotSupportedException |
373 | 410 | */ |
374 | - @DataScope(deptAlias = "d", userAlias = "u") | |
411 | + @Transactional | |
375 | 412 | @Override |
376 | 413 | public int updateMcVisitModification(McVisitModificationVo mcVisitModificationVo) throws CloneNotSupportedException { |
414 | + System.out.println("=====================>cccccccccmcVisitModificationVo:{}"+mcVisitModificationVo.toString()); | |
377 | 415 | McVisit mcVisit_old = mcVisitMapper.selectMcVisitById(mcVisitModificationVo.getId()); |
378 | 416 | if (BeanUtil.isEmpty(mcVisit_old)) { |
379 | 417 | throw new RuntimeException("未查询到记录"); |
... | ... | @@ -410,6 +448,7 @@ public class McVisitServiceImpl implements IMcVisitService { |
410 | 448 | * @return |
411 | 449 | * @throws CloneNotSupportedException |
412 | 450 | */ |
451 | + @Transactional | |
413 | 452 | @Override |
414 | 453 | public int updateMcVisitCancel(Long id, String remark) throws CloneNotSupportedException { |
415 | 454 | McVisit mcVisit = mcVisitMapper.selectMcVisitById(id); | ... | ... |
zr-cloud/zr-modules/zr-schsf/src/main/resources/mapper/McOperationLogMapper.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
2 | 2 | <!DOCTYPE mapper |
3 | -PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
4 | -"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
4 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
5 | 5 | <mapper namespace="com.chinagas.modules.schsf.mapper.McOperationLogMapper"> |
6 | - | |
7 | 6 | <resultMap type="com.chinagas.modules.schsf.domain.McOperationLog" id="McOperationLogResult"> |
8 | - <result property="id" column="id" /> | |
9 | - <result property="dataForm" column="data_form" /> | |
10 | - <result property="dataId" column="data_id" /> | |
11 | - <result property="procRole" column="proc_role" /> | |
12 | - <result property="procUser" column="proc_user" /> | |
13 | - <result property="procTime" column="proc_time" /> | |
14 | - <result property="procAccount" column="proc_account" /> | |
15 | - <result property="opName" column="op_name" /> | |
16 | - <result property="opType" column="op_type" /> | |
17 | - <result property="opRemark" column="op_remark" /> | |
18 | - <result property="beforeDataJson" column="before_data_json" /> | |
19 | - <result property="afterDataJson" column="after_data_json" /> | |
20 | - <result property="procId" column="proc_id" /> | |
7 | + <result property="id" column="id"/> | |
8 | + <result property="dataForm" column="data_form"/> | |
9 | + <result property="dataId" column="data_id"/> | |
10 | + <result property="procRole" column="proc_role"/> | |
11 | + <result property="procUser" column="proc_user"/> | |
12 | + <result property="procTime" column="proc_time"/> | |
13 | + <result property="procAccount" column="proc_account"/> | |
14 | + <result property="opName" column="op_name"/> | |
15 | + <result property="opType" column="op_type"/> | |
16 | + <result property="opRemark" column="op_remark"/> | |
17 | + <result property="beforeDataJson" column="before_data_json"/> | |
18 | + <result property="afterDataJson" column="after_data_json"/> | |
19 | + <result property="procId" column="proc_id"/> | |
21 | 20 | </resultMap> |
22 | 21 | |
23 | 22 | <sql id="selectMcOperationLogVo"> |
... | ... | @@ -33,25 +32,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
33 | 32 | op_remark, |
34 | 33 | before_data_json, |
35 | 34 | after_data_json, |
36 | - proc_id | |
35 | + proc_id | |
37 | 36 | from mc_operation_log |
38 | 37 | </sql> |
39 | 38 | |
40 | - <select id="selectMcOperationLogList" parameterType="com.chinagas.modules.schsf.domain.McOperationLog" resultMap="McOperationLogResult"> | |
39 | + <select id="selectMcOperationLogList" parameterType="com.chinagas.modules.schsf.domain.McOperationLog" | |
40 | + resultMap="McOperationLogResult"> | |
41 | 41 | <include refid="selectMcOperationLogVo"/> |
42 | 42 | <where> |
43 | - <if test="dataForm != null and dataForm != ''"> and data_form = #{dataForm}</if> | |
44 | - <if test="dataId != null "> and data_id = #{dataId}</if> | |
45 | - <if test="procRole != null and procRole != ''"> and proc_role = #{procRole}</if> | |
46 | - <if test="procUser != null and procUser != ''"> and proc_user = #{procUser}</if> | |
47 | - <if test="procTime != null "> and proc_time = #{procTime}</if> | |
48 | - <if test="procAccount != null and procAccount != ''"> and proc_account = #{procAccount}</if> | |
49 | - <if test="opName != null and opName != ''"> and op_name like concat('%', #{opName}, '%')</if> | |
50 | - <if test="opType != null and opType != ''"> and op_type = #{opType}</if> | |
51 | - <if test="opRemark != null and opRemark != ''"> and op_remark = #{opRemark}</if> | |
52 | - <if test="beforeDataJson != null and beforeDataJson != ''"> and before_data_json = #{beforeDataJson}</if> | |
53 | - <if test="afterDataJson != null and afterDataJson != ''"> and after_data_json = #{afterDataJson}</if> | |
54 | - <if test="procId != null and procId != ''"> and proc_id = #{procId}</if> | |
43 | + <if test="dataForm != null and dataForm != ''"> | |
44 | + and data_form = #{dataForm} | |
45 | + </if> | |
46 | + <if test="dataId != null"> | |
47 | + and data_id = #{dataId} | |
48 | + </if> | |
49 | + <if test="procRole != null and procRole != ''"> | |
50 | + and proc_role = #{procRole} | |
51 | + </if> | |
52 | + <if test="procUser != null and procUser != ''"> | |
53 | + and proc_user = #{procUser} | |
54 | + </if> | |
55 | + <if test="procTime != null"> | |
56 | + and proc_time = #{procTime} | |
57 | + </if> | |
58 | + <if test="procAccount != null and procAccount != ''"> | |
59 | + and proc_account = #{procAccount} | |
60 | + </if> | |
61 | + <if test="opName != null and opName != ''"> | |
62 | + and op_name like concat('%', #{opName}, '%') | |
63 | + </if> | |
64 | + <if test="opType != null and opType != ''"> | |
65 | + and op_type = #{opType} | |
66 | + </if> | |
67 | + <if test="opRemark != null and opRemark != ''"> | |
68 | + and op_remark = #{opRemark} | |
69 | + </if> | |
70 | + <if test="beforeDataJson != null and beforeDataJson != ''"> | |
71 | + and before_data_json = #{beforeDataJson} | |
72 | + </if> | |
73 | + <if test="afterDataJson != null and afterDataJson != ''"> | |
74 | + and after_data_json = #{afterDataJson} | |
75 | + </if> | |
76 | + <if test="procId != null and procId != ''"> | |
77 | + and proc_id = #{procId} | |
78 | + </if> | |
55 | 79 | </where> |
56 | 80 | order by proc_time desc |
57 | 81 | </select> |
... | ... | @@ -59,83 +83,150 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
59 | 83 | <insert id="insertMcOperationLog" parameterType="com.chinagas.modules.schsf.domain.McOperationLog"> |
60 | 84 | insert into mc_operation_log |
61 | 85 | <trim prefix="(" suffix=")" suffixOverrides=","> |
62 | - <if test="id != null">id,</if> | |
63 | - <if test="dataForm != null and dataForm != ''">data_form,</if> | |
64 | - <if test="dataId != null">data_id,</if> | |
65 | - <if test="procRole != null">proc_role,</if> | |
66 | - <if test="procUser != null and procUser != ''">proc_user,</if> | |
67 | - <if test="procTime != null">proc_time,</if> | |
68 | - <if test="procAccount != null and procAccount != ''">proc_account,</if> | |
69 | - <if test="opName != null">op_name,</if> | |
70 | - <if test="opType != null">op_type,</if> | |
71 | - <if test="opRemark != null">op_remark,</if> | |
72 | - <if test="beforeDataJson != null">before_data_json,</if> | |
73 | - <if test="afterDataJson != null">after_data_json,</if> | |
74 | - <if test="procId != null">proc_id,</if> | |
75 | - </trim> | |
86 | + <if test="id != null"> | |
87 | + id, | |
88 | + </if> | |
89 | + <if test="dataForm != null and dataForm != ''"> | |
90 | + data_form, | |
91 | + </if> | |
92 | + <if test="dataId != null"> | |
93 | + data_id, | |
94 | + </if> | |
95 | + <if test="procRole != null"> | |
96 | + proc_role, | |
97 | + </if> | |
98 | + <if test="procUser != null and procUser != ''"> | |
99 | + proc_user, | |
100 | + </if> | |
101 | + <if test="procTime != null"> | |
102 | + proc_time, | |
103 | + </if> | |
104 | + <if test="procAccount != null and procAccount != ''"> | |
105 | + proc_account, | |
106 | + </if> | |
107 | + <if test="opName != null"> | |
108 | + op_name, | |
109 | + </if> | |
110 | + <if test="opType != null"> | |
111 | + op_type, | |
112 | + </if> | |
113 | + <if test="opRemark != null"> | |
114 | + op_remark, | |
115 | + </if> | |
116 | + <if test="beforeDataJson != null"> | |
117 | + before_data_json, | |
118 | + </if> | |
119 | + <if test="afterDataJson != null"> | |
120 | + after_data_json, | |
121 | + </if> | |
122 | + <if test="procId != null"> | |
123 | + proc_id, | |
124 | + </if> | |
125 | + </trim> | |
76 | 126 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
77 | - <if test="id != null">#{id},</if> | |
78 | - <if test="dataForm != null and dataForm != ''">#{dataForm},</if> | |
79 | - <if test="dataId != null">#{dataId},</if> | |
80 | - <if test="procRole != null">#{procRole},</if> | |
81 | - <if test="procUser != null and procUser != ''">#{procUser},</if> | |
82 | - <if test="procTime != null">#{procTime},</if> | |
83 | - <if test="procAccount != null and procAccount != ''">#{procAccount},</if> | |
84 | - <if test="opName != null">#{opName},</if> | |
85 | - <if test="opType != null">#{opType},</if> | |
86 | - <if test="opRemark != null">#{opRemark},</if> | |
87 | - <if test="beforeDataJson != null">#{beforeDataJson},</if> | |
88 | - <if test="afterDataJson != null">#{afterDataJson},</if> | |
89 | - <if test="procId != null">#{procId},</if> | |
90 | - </trim> | |
127 | + <if test="id != null"> | |
128 | + #{id}, | |
129 | + </if> | |
130 | + <if test="dataForm != null and dataForm != ''"> | |
131 | + #{dataForm}, | |
132 | + </if> | |
133 | + <if test="dataId != null"> | |
134 | + #{dataId}, | |
135 | + </if> | |
136 | + <if test="procRole != null"> | |
137 | + #{procRole}, | |
138 | + </if> | |
139 | + <if test="procUser != null and procUser != ''"> | |
140 | + #{procUser}, | |
141 | + </if> | |
142 | + <if test="procTime != null"> | |
143 | + #{procTime}, | |
144 | + </if> | |
145 | + <if test="procAccount != null and procAccount != ''"> | |
146 | + #{procAccount}, | |
147 | + </if> | |
148 | + <if test="opName != null"> | |
149 | + #{opName}, | |
150 | + </if> | |
151 | + <if test="opType != null"> | |
152 | + #{opType}, | |
153 | + </if> | |
154 | + <if test="opRemark != null"> | |
155 | + #{opRemark}, | |
156 | + </if> | |
157 | + <if test="beforeDataJson != null"> | |
158 | + #{beforeDataJson}, | |
159 | + </if> | |
160 | + <if test="afterDataJson != null"> | |
161 | + #{afterDataJson}, | |
162 | + </if> | |
163 | + <if test="procId != null"> | |
164 | + #{procId}, | |
165 | + </if> | |
166 | + </trim> | |
91 | 167 | </insert> |
92 | 168 | |
93 | 169 | <select id="getUserMenuPermsByRoles" resultType="String" parameterType="String"> |
94 | - SELECT DISTINCT r.role_name as roleName FROM ( | |
95 | - SELECT role.role_name | |
96 | - FROM sys_menu menu | |
97 | - INNER JOIN sys_role_menu roleMenu on roleMenu.menu_id=menu.menu_id | |
98 | - INNER JOIN sys_role role on role.role_id= roleMenu.role_id | |
99 | - INNER JOIN sys_user_role userRole on userRole.role_id = role.role_id | |
100 | - INNER JOIN sys_user us on us.user_id = userRole.user_id | |
101 | - WHERE role.data_scope='1' | |
102 | - and menu.perms= #{menuPerms} | |
103 | - AND us.user_id= #{userId} | |
104 | - UNION | |
105 | - SELECT role.role_name | |
106 | - FROM sys_menu menu | |
107 | - INNER JOIN sys_role_menu roleMenu on roleMenu.menu_id=menu.menu_id | |
108 | - INNER JOIN sys_role role on role.role_id= roleMenu.role_id | |
109 | - INNER JOIN sys_user_role userRole on userRole.role_id = role.role_id | |
110 | - INNER JOIN sys_user us on us.user_id = userRole.user_id | |
111 | - INNER JOIN sys_user_dept userDept on userDept.user_id=us.user_id and userDept.dept_id = (SELECT company_code FROM mc_visit WHERE id= #{dataId} ) | |
112 | - INNER JOIN mc_visit visit on visit.company_code =userDept.dept_id | |
113 | - WHERE role.data_scope='3' | |
114 | - and menu.perms= #{menuPerms} | |
115 | - AND us.user_id= #{userId} | |
116 | - UNION | |
117 | - SELECT role.role_name | |
118 | - FROM sys_menu menu | |
119 | - INNER JOIN sys_role_menu roleMenu on roleMenu.menu_id=menu.menu_id | |
120 | - INNER JOIN sys_role role on role.role_id= roleMenu.role_id | |
121 | - INNER JOIN sys_user_role userRole on userRole.role_id = role.role_id | |
122 | - INNER JOIN sys_user us on us.user_id = userRole.user_id | |
123 | - INNER JOIN sys_user_dept userDept on userDept.user_id=us.user_id | |
124 | - INNER JOIN sys_dept dept on dept.dept_id =userDept.dept_id | |
125 | - INNER JOIN sys_dept dept2 on dept2.dept_id in (SELECT a.dept_id FROM sys_dept a WHERE a.dept_id = dept.dept_id or find_in_set(dept.parent_id , ancestors ) ) | |
126 | - and dept2.dept_id =(SELECT company_code FROM mc_visit WHERE id= #{dataId} ) | |
127 | - WHERE role.data_scope='4' | |
128 | - and menu.perms= #{menuPerms} | |
129 | - AND us.user_id=#{userId} | |
130 | - UNION | |
131 | - SELECT role.role_name | |
132 | - FROM sys_menu menu | |
133 | - INNER JOIN sys_role_menu roleMenu on roleMenu.menu_id=menu.menu_id | |
134 | - INNER JOIN sys_role role on role.role_id= roleMenu.role_id | |
135 | - INNER JOIN sys_user_role userRole on userRole.role_id = role.role_id and userRole.user_id = (SELECT create_by FROM mc_visit WHERE id= #{dataId} ) | |
136 | - WHERE role.data_scope='5' | |
137 | - and menu.perms= #{menuPerms} | |
138 | - AND userRole.user_id= #{userId} | |
139 | - ) r | |
170 | + SELECT DISTINCT r.role_name as roleName | |
171 | + FROM (SELECT role.role_name | |
172 | + FROM sys_menu menu | |
173 | + INNER JOIN sys_role_menu roleMenu on roleMenu.menu_id = menu.menu_id | |
174 | + INNER JOIN sys_role role on role.role_id = roleMenu.role_id | |
175 | + INNER JOIN sys_user_role userRole on userRole.role_id = role.role_id | |
176 | + INNER JOIN sys_user us on us.user_id = userRole.user_id | |
177 | + WHERE role.data_scope = '1' | |
178 | + and menu.perms = #{menuPerms} | |
179 | + AND us.user_id = #{userId} | |
180 | + UNION | |
181 | + SELECT role.role_name | |
182 | + FROM sys_menu menu | |
183 | + INNER JOIN sys_role_menu roleMenu on roleMenu.menu_id = menu.menu_id | |
184 | + INNER JOIN sys_role role on role.role_id = roleMenu.role_id | |
185 | + INNER JOIN sys_user_role userRole on userRole.role_id = role.role_id | |
186 | + INNER JOIN sys_user us on us.user_id = userRole.user_id | |
187 | + INNER JOIN sys_user_dept userDept on userDept.user_id = us.user_id and userDept.dept_id = | |
188 | + (SELECT company_code FROM mc_visit WHERE id = #{dataId}) | |
189 | + INNER JOIN mc_visit visit on visit.company_code = userDept.dept_id | |
190 | + WHERE role.data_scope = '3' | |
191 | + and menu.perms = #{menuPerms} | |
192 | + AND us.user_id = #{userId} | |
193 | + UNION | |
194 | + SELECT role.role_name | |
195 | + FROM sys_menu menu | |
196 | + INNER JOIN sys_role_menu roleMenu on roleMenu.menu_id = menu.menu_id | |
197 | + INNER JOIN sys_role role on role.role_id = roleMenu.role_id | |
198 | + INNER JOIN sys_user_role userRole on userRole.role_id = role.role_id | |
199 | + INNER JOIN sys_user us on us.user_id = userRole.user_id | |
200 | + INNER JOIN sys_user_dept userDept on userDept.user_id = us.user_id | |
201 | + INNER JOIN sys_dept dept on dept.dept_id = userDept.dept_id | |
202 | + INNER JOIN sys_dept dept2 on dept2.dept_id in (SELECT a.dept_id | |
203 | + FROM sys_dept a | |
204 | + WHERE a.dept_id = dept.dept_id | |
205 | + or find_in_set(dept.parent_id, ancestors)) | |
206 | + and dept2.dept_id = (SELECT company_code FROM mc_visit WHERE id = #{dataId}) | |
207 | + WHERE role.data_scope = '4' | |
208 | + and menu.perms = #{menuPerms} | |
209 | + AND us.user_id = #{userId} | |
210 | + UNION | |
211 | + SELECT role.role_name | |
212 | + FROM sys_menu menu | |
213 | + INNER JOIN sys_role_menu roleMenu on roleMenu.menu_id = menu.menu_id | |
214 | + INNER JOIN sys_role role on role.role_id = roleMenu.role_id | |
215 | + INNER JOIN sys_user_role userRole on userRole.role_id = role.role_id and userRole.user_id = | |
216 | + (SELECT create_by FROM mc_visit WHERE id = #{dataId}) | |
217 | + WHERE role.data_scope = '5' | |
218 | + and menu.perms = #{menuPerms} | |
219 | + AND userRole.user_id = #{userId}) r | |
220 | + </select> | |
221 | + | |
222 | + <select id="selectMcOperationLogNewYdById" parameterType="com.chinagas.modules.schsf.domain.McOperationLog" | |
223 | + resultMap="McOperationLogResult"> | |
224 | + <include refid="selectMcOperationLogVo"/> | |
225 | + WHERE 1=1 | |
226 | + and id =( | |
227 | + SELECT max(a.id) | |
228 | + FROM mc_operation_log a | |
229 | + WHERE a.op_type = #{opType}and a.data_id=#{dataId} and a.op_name= #{opName} | |
230 | + ) | |
140 | 231 | </select> |
141 | 232 | </mapper> | ... | ... |