WebMemberUnitController.java
4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package com.lhcredit.project.webbusiness.controller;
import java.util.Date;
import java.util.List;
import com.lhcredit.common.utils.StringUtils;
import com.lhcredit.common.utils.security.ShiroUtils;
import com.lhcredit.framework.aspectj.lang.enums.OperatorType;
import com.lhcredit.framework.web.page.TableDataInfo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.lhcredit.framework.aspectj.lang.annotation.Log;
import com.lhcredit.framework.aspectj.lang.enums.BusinessType;
import com.lhcredit.project.business.memberUnit.domain.MemberUnit;
import com.lhcredit.project.business.memberUnit.service.IMemberUnitService;
import com.lhcredit.framework.web.controller.BaseController;
import com.lhcredit.framework.web.domain.AjaxResult;
/**
* 会员单位信息对外接口
*
* @author lhcredit
* @date 2025-11-18
*/
@RestController
@RequestMapping("/web/memberUnit")
public class WebMemberUnitController extends BaseController {
@Autowired
private IMemberUnitService memberUnitService;
/**
* 查询会员单位列表接口
*/
@ApiOperation("查询会员单位列表")
@Log(title = "会员单位", businessType = BusinessType.LIST, operatorType = OperatorType.WEB)
@PostMapping("/getList")
public AjaxResult list(@RequestBody MemberUnit memberUnit) {
startPage(memberUnit.getPageNum(), memberUnit.getPageSize());
memberUnit.setDelStatus("0");
List<MemberUnit> list = memberUnitService.selectMemberUnitList(memberUnit);
return toAjax(list);
}
/**
* 查询会员单位详情接口
*/
@ApiOperation("查询会员单位详情")
@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "int", paramType = "path")
@Log(title = "会员单位", businessType = BusinessType.DETAIL, operatorType = OperatorType.WEB)
@GetMapping("/{id}")
public AjaxResult detail(@PathVariable Long id) {
MemberUnit memberUnit =memberUnitService.changeModel(memberUnitService.selectMemberUnitById(id));
if (StringUtils.isNull(memberUnit)) {
return AjaxResult.error("该信息不存在");
}
return toAjax(memberUnit);
}
/**
* 新增保存会员单位接口
*/
@ApiOperation("新增会员单位")
@ApiImplicitParam(name = "memberUnit", value = "会员单位", dataType = "MemberUnit")
@Log(title = "会员单位", businessType = BusinessType.INSERT, operatorType = OperatorType.WEB)
@PostMapping
public AjaxResult addSave(MemberUnit memberUnit) {
memberUnit.setCreateBy(ShiroUtils.getLoginName());
memberUnit.setCreateTime(new Date());
memberUnit.setUpdateBy(ShiroUtils.getLoginName());
memberUnit.setUpdateTime(new Date());
return toAjax(memberUnitService.insertMemberUnit(memberUnit));
}
/**
* 修改保存会员单位接口
*/
@ApiOperation("修改会员单位")
@ApiImplicitParam(name = "memberUnit", value = "会员单位", dataType = "MemberUnit")
@Log(title = "会员单位", businessType = BusinessType.UPDATE, operatorType = OperatorType.WEB)
@PutMapping
public AjaxResult update(MemberUnit memberUnit) {
if (StringUtils.isNull(memberUnit) || StringUtils.isNull(memberUnit.getId())){
return AjaxResult.error("主键id不能为空");
}
memberUnit.setUpdateBy(ShiroUtils.getLoginName());
memberUnit.setUpdateTime(new Date());
return toAjax(memberUnitService.updateMemberUnit(memberUnit));
}
/**
* 删除会员单位接口
*/
@ApiOperation("删除会员单位")
@ApiImplicitParam(name = "ids", value = "主键id,多条以英文逗号分隔", required = true, dataType = "String", paramType = "path")
@Log(title = "会员单位", businessType = BusinessType.DELETE, operatorType = OperatorType.WEB)
@DeleteMapping("/{ids}")
public AjaxResult delete(@PathVariable String ids) {
return toAjax(memberUnitService.deleteMemberUnitByIds(ids));
}
}