|
|
package com.bs.df.controller;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import com.bs.common.annotation.Anonymous;
|
|
|
import com.bs.common.core.domain.model.LoginBody;
|
|
|
import com.bs.web.utils.WeiXinUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import com.bs.common.annotation.Log;
|
|
|
import com.bs.common.core.controller.BaseController;
|
|
|
import com.bs.common.core.domain.AjaxResult;
|
|
|
import com.bs.common.core.page.TableDataInfo;
|
|
|
import com.bs.common.enums.BusinessType;
|
|
|
import com.bs.common.utils.poi.ExcelUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import com.bs.df.domain.DfUserBroker;
|
|
|
import com.bs.df.service.IDfUserBrokerService;
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
/**
|
|
|
* 客户经纪Controller
|
|
|
*
|
|
|
* @author bs
|
|
|
* @date 2024-04-06
|
|
|
*/
|
|
|
@Api(tags = "客户经纪")
|
|
|
@RestController
|
|
|
@RequestMapping("/user/broker")
|
|
|
public class DfUserBrokerController extends BaseController {
|
|
|
@Resource
|
|
|
private IDfUserBrokerService dfUserBrokerService;
|
|
|
/**
|
|
|
* 分页查询客户经纪列表
|
|
|
*/
|
|
|
@ApiOperation("分页查询客户经纪列表")
|
|
|
@GetMapping("/pageList")
|
|
|
public TableDataInfo pageList(DfUserBroker dfUserBroker) {
|
|
|
startPage();
|
|
|
LambdaQueryWrapper<DfUserBroker> queryWrapper = new LambdaQueryWrapper();
|
|
|
condition(queryWrapper,dfUserBroker);
|
|
|
List<DfUserBroker> list = dfUserBrokerService.list(queryWrapper);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询客户经纪列表
|
|
|
*/
|
|
|
@ApiOperation("查询客户经纪列表")
|
|
|
@GetMapping("/list")
|
|
|
public AjaxResult list(DfUserBroker dfUserBroker) {
|
|
|
LambdaQueryWrapper<DfUserBroker> queryWrapper = new LambdaQueryWrapper();
|
|
|
condition(queryWrapper,dfUserBroker);
|
|
|
List<DfUserBroker> list = dfUserBrokerService.list(queryWrapper);
|
|
|
return success(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导出客户经纪列表
|
|
|
*/
|
|
|
@ApiOperation("导出客户经纪列表")
|
|
|
@Log(title = "客户经纪导出", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
public void export(HttpServletResponse response, DfUserBroker dfUserBroker) {
|
|
|
LambdaQueryWrapper<DfUserBroker> queryWrapper = new LambdaQueryWrapper();
|
|
|
condition(queryWrapper,dfUserBroker);
|
|
|
List<DfUserBroker> list = dfUserBrokerService.list(queryWrapper);
|
|
|
ExcelUtil<DfUserBroker> util = new ExcelUtil<DfUserBroker>(DfUserBroker. class);
|
|
|
util.exportExcel(response, list, "客户经纪数据");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取客户经纪详细信息
|
|
|
*/
|
|
|
@ApiOperation("获取客户经纪详细信息")
|
|
|
@GetMapping(value = "/{id}")
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
return success(dfUserBrokerService.getById(id));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 新增客户经纪
|
|
|
*/
|
|
|
@ApiOperation("新增客户经纪")
|
|
|
@Log(title = "客户经纪新增", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody DfUserBroker dfUserBroker) {
|
|
|
return toAjax(dfUserBrokerService.save(dfUserBroker));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改客户经纪
|
|
|
*/
|
|
|
@ApiOperation("修改客户经纪")
|
|
|
@Log(title = "客户经纪修改", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@RequestBody DfUserBroker dfUserBroker) {
|
|
|
return toAjax(dfUserBrokerService.updateById(dfUserBroker));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除客户经纪
|
|
|
*/
|
|
|
@ApiOperation("删除客户经纪")
|
|
|
@Log(title = "客户经纪删除", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{ids}")
|
|
|
public AjaxResult remove(@PathVariable List<Long> ids) {
|
|
|
return toAjax(dfUserBrokerService.removeBatchByIds(ids));
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 条件设置
|
|
|
*/
|
|
|
private void condition (LambdaQueryWrapper<DfUserBroker> queryWrapper,DfUserBroker dfUserBroker){
|
|
|
|
|
|
|
|
|
//id
|
|
|
if(Validator.isNotEmpty(dfUserBroker.getId())){
|
|
|
queryWrapper.eq(DfUserBroker::getId,dfUserBroker.getId());
|
|
|
}
|
|
|
|
|
|
//客户id
|
|
|
if(Validator.isNotEmpty(dfUserBroker.getUserId())){
|
|
|
queryWrapper.eq(DfUserBroker::getUserId,dfUserBroker.getUserId());
|
|
|
}
|
|
|
|
|
|
//经纪id
|
|
|
if(Validator.isNotEmpty(dfUserBroker.getBrokerId())){
|
|
|
queryWrapper.eq(DfUserBroker::getBrokerId,dfUserBroker.getBrokerId());
|
|
|
}
|
|
|
|
|
|
//创建部门
|
|
|
if(Validator.isNotEmpty(dfUserBroker.getCreateDept())){
|
|
|
queryWrapper.eq(DfUserBroker::getCreateDept,dfUserBroker.getCreateDept());
|
|
|
}
|
|
|
|
|
|
//创建人员
|
|
|
if(Validator.isNotEmpty(dfUserBroker.getCreateBy())){
|
|
|
queryWrapper.eq(DfUserBroker::getCreateBy,dfUserBroker.getCreateBy());
|
|
|
}
|
|
|
|
|
|
//创建时间
|
|
|
if(Validator.isNotEmpty(dfUserBroker.getCreateTime())){
|
|
|
queryWrapper.eq(DfUserBroker::getCreateTime,dfUserBroker.getCreateTime());
|
|
|
}
|
|
|
|
|
|
//修改人员
|
|
|
if(Validator.isNotEmpty(dfUserBroker.getUpdateBy())){
|
|
|
queryWrapper.eq(DfUserBroker::getUpdateBy,dfUserBroker.getUpdateBy());
|
|
|
}
|
|
|
|
|
|
//修改时间
|
|
|
if(Validator.isNotEmpty(dfUserBroker.getUpdateTime())){
|
|
|
queryWrapper.eq(DfUserBroker::getUpdateTime,dfUserBroker.getUpdateTime());
|
|
|
}
|
|
|
|
|
|
//删除标志(0代表存在 2代表删除)
|
|
|
if(Validator.isNotEmpty(dfUserBroker.getDelFlag())){
|
|
|
queryWrapper.eq(DfUserBroker::getDelFlag,dfUserBroker.getDelFlag());
|
|
|
}
|
|
|
|
|
|
//租户id
|
|
|
if(Validator.isNotEmpty(dfUserBroker.getTenantId())){
|
|
|
queryWrapper.eq(DfUserBroker::getTenantId,dfUserBroker.getTenantId());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|