SaleServiceController.java
3.7 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
package com.huaheng.pc.saleService.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huaheng.common.support.Convert;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.framework.web.page.PageDomain;
import com.huaheng.framework.web.page.TableDataInfo;
import com.huaheng.framework.web.page.TableSupport;
import com.huaheng.pc.exam.answer.domain.AnswerType;
import com.huaheng.pc.exam.answer.service.AnswerTypeService;
import com.huaheng.pc.saleService.domain.SaleService;
import com.huaheng.pc.saleService.service.SaleServicesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
/**
* @author:zhouhong
* 2022021
*/
@Api(tags = {"验证码类"})
@Controller
@RequestMapping("/saleService")
public class SaleServiceController extends BaseController {
@Resource
private SaleServicesService saleServicesService;
private String prefix = "saleService";
@GetMapping()
public String verificationCodeList()
{
return prefix + "/list";
}
/**
* 查询验证码列表
*/
@ApiOperation(value = "查看验证码列表",
notes = "根据姓名、电话、类型筛选答卷信息",
httpMethod = "POST")
@Log(title = "试卷管理-验证码列表", operating = "查看验证码列表", action = BusinessType.GRANT)
@PostMapping("/list")
@ResponseBody
public TableDataInfo list (SaleService saleService) {
LambdaQueryWrapper<SaleService> lambdaQueryWrapper = Wrappers.lambdaQuery();
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
lambdaQueryWrapper.like(StringUtils.isNotEmpty(saleService.getPerson()),SaleService::getPerson,saleService.getPerson())
.eq(StringUtils.isNotEmpty(saleService.getPhone()), SaleService::getPhone,saleService.getPhone())
.eq(StringUtils.isNotEmpty(saleService.getProductType()), SaleService::getProductType,saleService.getProductType());
if(StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
/*使用分页查询*/
Page<SaleService> page = new Page<>(pageNum, pageSize);
IPage<SaleService> iPage = saleServicesService.page(page, lambdaQueryWrapper);
return getMpDataTable(iPage.getRecords(), iPage.getTotal());
} else {
List<SaleService> list = saleServicesService.list(lambdaQueryWrapper);
return getDataTable(list);
}
}
@Log(title = "管理", operating = "删除", action = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
try
{
return toAjax(saleServicesService.removeByIds(Arrays.asList(Convert.toIntArray(ids))));
}
catch (Exception e)
{
return error(e.getMessage());
}
}
}