package com.gear.admin.controller.swx;;
|
|
import java.util.List;
|
import javax.servlet.http.HttpServletResponse;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.gear.common.builder.WhereBuilder;
|
import com.gear.common.vo.Result;
|
import com.gear.swx.domain.SwxLoanRecord;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
import com.gear.common.annotation.Log;
|
import com.gear.common.core.controller.BaseController;
|
import com.gear.common.enums.BusinessType;
|
import com.gear.swx.domain.SwxLoanSettings;
|
import com.gear.swx.service.ISwxLoanSettingsService;
|
import com.gear.common.utils.poi.ExcelUtil;
|
|
/**
|
* 贷款管理Controller
|
*
|
* @author czx
|
* @date 2023-11-20
|
*/
|
@RestController
|
@RequestMapping("/swx/loanSettings")
|
public class SwxLoanSettingsController extends BaseController
|
{
|
@Autowired
|
private ISwxLoanSettingsService swxLoanSettingsService;
|
|
/**
|
* 查询贷款管理列表
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:loanSettings:list')")
|
@GetMapping("/list")
|
public Result<IPage<SwxLoanSettings>> list(SwxLoanSettings swxLoanSettings,
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
|
QueryWrapper<SwxLoanSettings> queryWrapper = WhereBuilder.build(swxLoanSettings);
|
queryWrapper.lambda().orderByDesc(SwxLoanSettings::getCreateTime);
|
Page<SwxLoanSettings> page = new Page<SwxLoanSettings>(pageNo, pageSize);
|
IPage<SwxLoanSettings> pageList = swxLoanSettingsService.page(page, queryWrapper);
|
return Result.OK(pageList);
|
}
|
|
/**
|
* 导出贷款管理列表
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:loanSettings:export')")
|
@Log(title = "贷款管理", businessType = BusinessType.EXPORT)
|
@PostMapping("/export")
|
public void export(HttpServletResponse response, SwxLoanSettings swxLoanSettings){
|
QueryWrapper<SwxLoanSettings> queryWrapper = WhereBuilder.build(swxLoanSettings);
|
List<SwxLoanSettings> list = swxLoanSettingsService.list(queryWrapper);
|
ExcelUtil<SwxLoanSettings> util = new ExcelUtil<SwxLoanSettings>(SwxLoanSettings.class);
|
util.exportExcel(response, list, "贷款管理数据");
|
}
|
|
/**
|
* 获取贷款管理详细信息
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:loanSettings:query')")
|
@GetMapping(value = "/{id}")
|
public Result<SwxLoanSettings> getInfo(@PathVariable("id") String id){
|
SwxLoanSettings swxLoanSettings = swxLoanSettingsService.getById(id);
|
if(swxLoanSettings==null) {
|
return Result.error("未找到对应数据");
|
}
|
return Result.OK(swxLoanSettings);
|
}
|
|
/**
|
* 新增贷款管理
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:loanSettings:add')")
|
@Log(title = "贷款管理", businessType = BusinessType.INSERT)
|
@PostMapping
|
public Result<String> add(@RequestBody SwxLoanSettings swxLoanSettings){
|
swxLoanSettingsService.save(swxLoanSettings);
|
return Result.ok("添加成功!");
|
}
|
|
/**
|
* 修改贷款管理
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:loanSettings:edit')")
|
@Log(title = "贷款管理", businessType = BusinessType.UPDATE)
|
@PutMapping
|
public Result<String> edit(@RequestBody SwxLoanSettings swxLoanSettings){
|
swxLoanSettingsService.updateById(swxLoanSettings);
|
return Result.ok("编辑成功!");
|
}
|
|
/**
|
* 删除贷款管理
|
*/
|
@PreAuthorize("@ss.hasPermi('swx:loanSettings:remove')")
|
@Log(title = "贷款管理", businessType = BusinessType.DELETE)
|
@DeleteMapping("/{ids}")
|
public Result<String> remove(@PathVariable List<String> ids){
|
swxLoanSettingsService.removeBatchByIds(ids);
|
return Result.ok("删除成功!");
|
}
|
}
|