提交 fae1c3f5 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码

上级 4103c631
package cn.ibizlab.businesscentral.core.dto;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.math.BigInteger;
import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.alibaba.fastjson.annotation.JSONField;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import cn.ibizlab.businesscentral.util.domain.DTOBase;
import cn.ibizlab.businesscentral.util.domain.DTOClient;
import lombok.Data;
/**
* 服务DTO对象[Res_supplierDTO]
*/
@Data
public class Res_supplierDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性 [ID]
*
*/
@JSONField(name = "id")
@JsonProperty("id")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 属性 [NAME]
*
*/
@JSONField(name = "name")
@JsonProperty("name")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String name;
/**
* 属性 [TYPE]
*
*/
@JSONField(name = "type")
@JsonProperty("type")
@Size(min = 0, max = 60, message = "内容长度必须小于等于[60]")
private String type;
/**
* 属性 [COMPANY_TYPE]
*
*/
@JSONField(name = "company_type")
@JsonProperty("company_type")
@Size(min = 0, max = 200, message = "内容长度必须小于等于[200]")
private String companyType;
/**
* 属性 [PHONE]
*
*/
@JSONField(name = "phone")
@JsonProperty("phone")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String phone;
/**
* 属性 [IBIZFUNCTION]
*
*/
@JSONField(name = "ibizfunction")
@JsonProperty("ibizfunction")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String ibizfunction;
/**
* 属性 [MOBILE]
*
*/
@JSONField(name = "mobile")
@JsonProperty("mobile")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String mobile;
/**
* 属性 [VAT]
*
*/
@JSONField(name = "vat")
@JsonProperty("vat")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String vat;
/**
* 属性 [EMAIL]
*
*/
@JSONField(name = "email")
@JsonProperty("email")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String email;
/**
* 属性 [WEBSITE_URL]
*
*/
@JSONField(name = "website_url")
@JsonProperty("website_url")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String websiteUrl;
/**
* 属性 [CATEGORY_ID]
*
*/
@JSONField(name = "category_id")
@JsonProperty("category_id")
@Size(min = 0, max = 1048576, message = "内容长度必须小于等于[1048576]")
private String categoryId;
/**
* 设置 [NAME]
*/
public void setName(String name){
this.name = name ;
this.modify("name",name);
}
/**
* 设置 [TYPE]
*/
public void setType(String type){
this.type = type ;
this.modify("type",type);
}
/**
* 设置 [PHONE]
*/
public void setPhone(String phone){
this.phone = phone ;
this.modify("phone",phone);
}
/**
* 设置 [IBIZFUNCTION]
*/
public void setIbizfunction(String ibizfunction){
this.ibizfunction = ibizfunction ;
this.modify("ibizfunction",ibizfunction);
}
/**
* 设置 [MOBILE]
*/
public void setMobile(String mobile){
this.mobile = mobile ;
this.modify("mobile",mobile);
}
/**
* 设置 [VAT]
*/
public void setVat(String vat){
this.vat = vat ;
this.modify("vat",vat);
}
/**
* 设置 [EMAIL]
*/
public void setEmail(String email){
this.email = email ;
this.modify("email",email);
}
}
package cn.ibizlab.businesscentral.core.mapping;
import org.mapstruct.*;
import cn.ibizlab.businesscentral.core.odoo_base.domain.Res_supplier;
import cn.ibizlab.businesscentral.core.dto.Res_supplierDTO;
import cn.ibizlab.businesscentral.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},implementationName="CoreRes_supplierMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface Res_supplierMapping extends MappingBase<Res_supplierDTO, Res_supplier> {
}
package cn.ibizlab.businesscentral.core.rest;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.businesscentral.core.dto.*;
import cn.ibizlab.businesscentral.core.mapping.*;
import cn.ibizlab.businesscentral.core.odoo_base.domain.Res_supplier;
import cn.ibizlab.businesscentral.core.odoo_base.service.IRes_supplierService;
import cn.ibizlab.businesscentral.core.odoo_base.filter.Res_supplierSearchContext;
import cn.ibizlab.businesscentral.util.annotation.VersionCheck;
@Slf4j
@Api(tags = {"供应商" })
@RestController("Core-res_supplier")
@RequestMapping("")
public class Res_supplierResource {
@Autowired
public IRes_supplierService res_supplierService;
@Autowired
@Lazy
public Res_supplierMapping res_supplierMapping;
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Res_supplier-Create-all')")
@ApiOperation(value = "新建供应商", tags = {"供应商" }, notes = "新建供应商")
@RequestMapping(method = RequestMethod.POST, value = "/res_suppliers")
public ResponseEntity<Res_supplierDTO> create(@Validated @RequestBody Res_supplierDTO res_supplierdto) {
Res_supplier domain = res_supplierMapping.toDomain(res_supplierdto);
res_supplierService.create(domain);
Res_supplierDTO dto = res_supplierMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Res_supplier-Create-all')")
@ApiOperation(value = "批量新建供应商", tags = {"供应商" }, notes = "批量新建供应商")
@RequestMapping(method = RequestMethod.POST, value = "/res_suppliers/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<Res_supplierDTO> res_supplierdtos) {
res_supplierService.createBatch(res_supplierMapping.toDomain(res_supplierdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Res_supplier-Update-all')")
@ApiOperation(value = "更新供应商", tags = {"供应商" }, notes = "更新供应商")
@RequestMapping(method = RequestMethod.PUT, value = "/res_suppliers/{res_supplier_id}")
public ResponseEntity<Res_supplierDTO> update(@PathVariable("res_supplier_id") Long res_supplier_id, @RequestBody Res_supplierDTO res_supplierdto) {
Res_supplier domain = res_supplierMapping.toDomain(res_supplierdto);
domain .setId(res_supplier_id);
res_supplierService.update(domain );
Res_supplierDTO dto = res_supplierMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Res_supplier-Update-all')")
@ApiOperation(value = "批量更新供应商", tags = {"供应商" }, notes = "批量更新供应商")
@RequestMapping(method = RequestMethod.PUT, value = "/res_suppliers/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<Res_supplierDTO> res_supplierdtos) {
res_supplierService.updateBatch(res_supplierMapping.toDomain(res_supplierdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Res_supplier-Remove-all')")
@ApiOperation(value = "删除供应商", tags = {"供应商" }, notes = "删除供应商")
@RequestMapping(method = RequestMethod.DELETE, value = "/res_suppliers/{res_supplier_id}")
public ResponseEntity<Boolean> remove(@PathVariable("res_supplier_id") Long res_supplier_id) {
return ResponseEntity.status(HttpStatus.OK).body(res_supplierService.remove(res_supplier_id));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Res_supplier-Remove-all')")
@ApiOperation(value = "批量删除供应商", tags = {"供应商" }, notes = "批量删除供应商")
@RequestMapping(method = RequestMethod.DELETE, value = "/res_suppliers/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<Long> ids) {
res_supplierService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Res_supplier-Get-all')")
@ApiOperation(value = "获取供应商", tags = {"供应商" }, notes = "获取供应商")
@RequestMapping(method = RequestMethod.GET, value = "/res_suppliers/{res_supplier_id}")
public ResponseEntity<Res_supplierDTO> get(@PathVariable("res_supplier_id") Long res_supplier_id) {
Res_supplier domain = res_supplierService.get(res_supplier_id);
Res_supplierDTO dto = res_supplierMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "获取供应商草稿", tags = {"供应商" }, notes = "获取供应商草稿")
@RequestMapping(method = RequestMethod.GET, value = "/res_suppliers/getdraft")
public ResponseEntity<Res_supplierDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(res_supplierMapping.toDto(res_supplierService.getDraft(new Res_supplier())));
}
@ApiOperation(value = "检查供应商", tags = {"供应商" }, notes = "检查供应商")
@RequestMapping(method = RequestMethod.POST, value = "/res_suppliers/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody Res_supplierDTO res_supplierdto) {
return ResponseEntity.status(HttpStatus.OK).body(res_supplierService.checkKey(res_supplierMapping.toDomain(res_supplierdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Res_supplier-Save-all')")
@ApiOperation(value = "保存供应商", tags = {"供应商" }, notes = "保存供应商")
@RequestMapping(method = RequestMethod.POST, value = "/res_suppliers/save")
public ResponseEntity<Boolean> save(@RequestBody Res_supplierDTO res_supplierdto) {
return ResponseEntity.status(HttpStatus.OK).body(res_supplierService.save(res_supplierMapping.toDomain(res_supplierdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Res_supplier-Save-all')")
@ApiOperation(value = "批量保存供应商", tags = {"供应商" }, notes = "批量保存供应商")
@RequestMapping(method = RequestMethod.POST, value = "/res_suppliers/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<Res_supplierDTO> res_supplierdtos) {
res_supplierService.saveBatch(res_supplierMapping.toDomain(res_supplierdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Res_supplier-searchDefault-all')")
@ApiOperation(value = "获取数据集", tags = {"供应商" } ,notes = "获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/res_suppliers/fetchdefault")
public ResponseEntity<List<Res_supplierDTO>> fetchDefault(Res_supplierSearchContext context) {
Page<Res_supplier> domains = res_supplierService.searchDefault(context) ;
List<Res_supplierDTO> list = res_supplierMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Res_supplier-searchDefault-all')")
@ApiOperation(value = "查询数据集", tags = {"供应商" } ,notes = "查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/res_suppliers/searchdefault")
public ResponseEntity<Page<Res_supplierDTO>> searchDefault(@RequestBody Res_supplierSearchContext context) {
Page<Res_supplier> domains = res_supplierService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(res_supplierMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册