去掉客户类型
This commit is contained in:
parent
c010ae8b98
commit
ce5763e2bf
@ -1,125 +0,0 @@
|
||||
package com.aircraft.modules.system.controller;
|
||||
|
||||
|
||||
import com.aircraft.annotation.Log;
|
||||
import com.aircraft.modules.system.domain.CnCustomerType;
|
||||
import com.aircraft.modules.system.service.CnCustomerTypeService;
|
||||
import com.aircraft.utils.PageResult;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import kotlin.Result;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author cli
|
||||
* @since 2025-07-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cnCustomerType")
|
||||
public class CnCustomerTypeController {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CnCustomerTypeController.class);
|
||||
@Autowired
|
||||
private CnCustomerTypeService entityService;
|
||||
|
||||
@Log("分页查询客户类型")
|
||||
@ApiOperation(value = "分页查询客户类型", notes = "分页查询客户类型")
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "size", value = "分页大小", paramType = "query"),
|
||||
@ApiImplicitParam(name = "current", value = "当前页面:从1开始", paramType = "query")})
|
||||
public ResponseEntity<PageResult<CnCustomerType>> findByPage(final CnCustomerType example, final Page page) {
|
||||
PageResult<CnCustomerType> records = entityService.page(example,page);
|
||||
return new ResponseEntity<>(records,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("删除客户类型")
|
||||
@ApiOperation(value = "删除客户类型")
|
||||
@RequestMapping(value = "{id}", method = {RequestMethod.DELETE})
|
||||
@ApiImplicitParam(name = "id", value = "客户类型ID", required = true, paramType = "path")
|
||||
public ResponseEntity<Object> delete(@PathVariable final Integer id) {
|
||||
try {
|
||||
entityService.removeById(id);
|
||||
return new ResponseEntity<>("成功删除客户类型",HttpStatus.OK);
|
||||
} catch (DataIntegrityViolationException e) {
|
||||
LOG.error("删除客户类型失败", e);
|
||||
throw new RuntimeException( "删除客户类型失败,该客户类型不能删除,存在其他关联数据",e);
|
||||
} catch (Exception e) {
|
||||
LOG.error("删除客户类型失败", e);
|
||||
throw new RuntimeException( "删除客户类型失败",e);
|
||||
}
|
||||
}
|
||||
|
||||
@Log("查询单个客户类型")
|
||||
@ApiOperation(value = "查询单个客户类型")
|
||||
@RequestMapping(value = "{id}", method = {RequestMethod.GET})
|
||||
@ApiImplicitParam(name = "id", value = "客户类型ID", required = true, paramType = "path")
|
||||
public ResponseEntity<Object> one(@PathVariable final Integer id) {
|
||||
try {
|
||||
CnCustomerType entity = entityService.getById(id);
|
||||
return new ResponseEntity<>(entity,HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
LOG.error("查询单个客户类型失败", e);
|
||||
throw new RuntimeException( "查询单个客户类型失败",e);
|
||||
}
|
||||
}
|
||||
|
||||
@Log("添加客户类型")
|
||||
@ApiOperation(value = "添加客户类型")
|
||||
@RequestMapping(method = {RequestMethod.POST})
|
||||
public ResponseEntity<Object> add(@Valid @RequestBody final CnCustomerType entity, final BindingResult result) {
|
||||
try {
|
||||
entityService.save(entity);
|
||||
return new ResponseEntity<>("成功保存客户类型",HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
LOG.error("添加客户类型失败", e);
|
||||
throw new RuntimeException( "添加客户类型失败",e);
|
||||
}
|
||||
}
|
||||
|
||||
@Log("修改客户类型")
|
||||
@ApiOperation(value = "修改客户类型")
|
||||
@RequestMapping(method = {RequestMethod.PUT})
|
||||
public ResponseEntity<Object> update(@Valid @RequestBody final CnCustomerType entity, final BindingResult result) {
|
||||
try {
|
||||
if (null == entity.getId()) {
|
||||
throw new RuntimeException("id不能为空");
|
||||
}
|
||||
entityService.updateById(entity);
|
||||
return new ResponseEntity<>("成功修改客户类型",HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
LOG.error("修改客户类型失败", e);
|
||||
throw new RuntimeException( "修改客户类型失败",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "全部客户类型")
|
||||
@RequestMapping(value = "all", method = RequestMethod.GET)
|
||||
public ResponseEntity<Object> all(CnCustomerType example) {
|
||||
List<CnCustomerType> entitys = entityService.list(example);
|
||||
if (null != entitys) {
|
||||
return new ResponseEntity<>(entitys,HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(Collections.emptyList(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
package com.aircraft.modules.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.aircraft.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author cli
|
||||
* @since 2025-07-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cn_customer_type")
|
||||
public class CnCustomerType extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package com.aircraft.modules.system.mapper;
|
||||
|
||||
import com.aircraft.modules.system.domain.CnCustomerType;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author cli
|
||||
* @since 2025-07-09
|
||||
*/
|
||||
@Mapper
|
||||
public interface CnCustomerTypeMapper extends BaseMapper<CnCustomerType> {
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.aircraft.modules.system.service;
|
||||
|
||||
import com.aircraft.modules.system.domain.CnCustomerType;
|
||||
import com.aircraft.utils.PageResult;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author cli
|
||||
* @since 2025-07-09
|
||||
*/
|
||||
public interface CnCustomerTypeService extends IService<CnCustomerType> {
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
* @param example
|
||||
* @return
|
||||
*/
|
||||
List<CnCustomerType> list(CnCustomerType example);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param example
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
PageResult<CnCustomerType> page(CnCustomerType example, IPage page);
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package com.aircraft.modules.system.service.impl;
|
||||
|
||||
import com.aircraft.modules.system.domain.CnCustomerType;
|
||||
import com.aircraft.modules.system.mapper.CnCustomerTypeMapper;
|
||||
import com.aircraft.modules.system.service.CnCustomerTypeService;
|
||||
import com.aircraft.utils.PageResult;
|
||||
import com.aircraft.utils.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author cli
|
||||
* @since 2025-07-09
|
||||
*/
|
||||
@Service
|
||||
public class CnCustomerTypeServiceImpl extends ServiceImpl<CnCustomerTypeMapper, CnCustomerType> implements CnCustomerTypeService {
|
||||
|
||||
@Override
|
||||
public List<CnCustomerType> list(CnCustomerType example) {
|
||||
return this.list(buildWrapper(example));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CnCustomerType> page(CnCustomerType example, IPage page) {
|
||||
return PageUtil.toPage(this.page(page,buildWrapper(example)).getRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询
|
||||
*
|
||||
* @param example
|
||||
* @return
|
||||
*/
|
||||
private QueryWrapper<CnCustomerType> buildWrapper(CnCustomerType example) {
|
||||
QueryWrapper<CnCustomerType> wrapper = new QueryWrapper<>();
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.aircraft.modules.system.mapper.CnCustomerTypeMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user