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

zhouweidong 发布系统代码

上级 081bcf8d
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
<!--输出实体[DST_SYSTEM]数据结构 --> <!--输出实体[DST_SYSTEM]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-dst_system-26-5"> <changeSet author="a_A_5d9d78509" id="tab-dst_system-29-5">
<createTable tableName="IBZPSSYSTEM"> <createTable tableName="IBZPSSYSTEM">
<column name="PSSYSTEMID" remarks="" type="VARCHAR(100)"> <column name="PSSYSTEMID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DST_SYSTEM_PSSYSTEMID"/> <constraints primaryKey="true" primaryKeyName="PK_DST_SYSTEM_PSSYSTEMID"/>
......
package cn.ibizlab.api.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.alibaba.fastjson.annotation.JSONField;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import cn.ibizlab.util.domain.DTOBase;
import cn.ibizlab.util.domain.DTOClient;
import lombok.Data;
/**
* 服务DTO对象[DstSystemDTO]
*/
@Data
public class DstSystemDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性 [PSSYSTEMID]
*
*/
@JSONField(name = "pssystemid")
@JsonProperty("pssystemid")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String pssystemid;
/**
* 属性 [PSSYSTEMNAME]
*
*/
@JSONField(name = "pssystemname")
@JsonProperty("pssystemname")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String pssystemname;
/**
* 属性 [SYSSTRUCTURE]
*
*/
@JSONField(name = "sysstructure")
@JsonProperty("sysstructure")
@Size(min = 0, max = 1048576, message = "内容长度必须小于等于[1048576]")
private String sysstructure;
/**
* 属性 [MD5CHECK]
*
*/
@JSONField(name = "md5check")
@JsonProperty("md5check")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String md5check;
/**
* 属性 [SHOWORDER]
*
*/
@JSONField(name = "showorder")
@JsonProperty("showorder")
private Integer showorder;
/**
* 设置 [PSSYSTEMNAME]
*/
public void setPssystemname(String pssystemname){
this.pssystemname = pssystemname ;
this.modify("pssystemname",pssystemname);
}
/**
* 设置 [SYSSTRUCTURE]
*/
public void setSysstructure(String sysstructure){
this.sysstructure = sysstructure ;
this.modify("sysstructure",sysstructure);
}
/**
* 设置 [MD5CHECK]
*/
public void setMd5check(String md5check){
this.md5check = md5check ;
this.modify("md5check",md5check);
}
/**
* 设置 [SHOWORDER]
*/
public void setShoworder(Integer showorder){
this.showorder = showorder ;
this.modify("showorder",showorder);
}
}
package cn.ibizlab.api.mapping;
import org.mapstruct.*;
import cn.ibizlab.core.lite.domain.DstSystem;
import cn.ibizlab.api.dto.DstSystemDTO;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},implementationName="apiDstSystemMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface DstSystemMapping extends MappingBase<DstSystemDTO, DstSystem> {
}
package cn.ibizlab.api.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.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.lite.domain.DstSystem;
import cn.ibizlab.core.lite.service.IDstSystemService;
import cn.ibizlab.core.lite.filter.DstSystemSearchContext;
import cn.ibizlab.util.annotation.VersionCheck;
@Slf4j
@Api(tags = {"系统" })
@RestController("api-dstsystem")
@RequestMapping("")
public class DstSystemResource {
@Autowired
public IDstSystemService dstsystemService;
@Autowired
@Lazy
public DstSystemMapping dstsystemMapping;
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-DstSystem-Create-all')")
@ApiOperation(value = "新建系统", tags = {"系统" }, notes = "新建系统")
@RequestMapping(method = RequestMethod.POST, value = "/dstsystems")
public ResponseEntity<DstSystemDTO> create(@Validated @RequestBody DstSystemDTO dstsystemdto) {
DstSystem domain = dstsystemMapping.toDomain(dstsystemdto);
dstsystemService.create(domain);
DstSystemDTO dto = dstsystemMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-DstSystem-Create-all')")
@ApiOperation(value = "批量新建系统", tags = {"系统" }, notes = "批量新建系统")
@RequestMapping(method = RequestMethod.POST, value = "/dstsystems/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<DstSystemDTO> dstsystemdtos) {
dstsystemService.createBatch(dstsystemMapping.toDomain(dstsystemdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-DstSystem-Update-all')")
@ApiOperation(value = "更新系统", tags = {"系统" }, notes = "更新系统")
@RequestMapping(method = RequestMethod.PUT, value = "/dstsystems/{dstsystem_id}")
public ResponseEntity<DstSystemDTO> update(@PathVariable("dstsystem_id") String dstsystem_id, @RequestBody DstSystemDTO dstsystemdto) {
DstSystem domain = dstsystemMapping.toDomain(dstsystemdto);
domain .setPssystemid(dstsystem_id);
dstsystemService.update(domain );
DstSystemDTO dto = dstsystemMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-DstSystem-Update-all')")
@ApiOperation(value = "批量更新系统", tags = {"系统" }, notes = "批量更新系统")
@RequestMapping(method = RequestMethod.PUT, value = "/dstsystems/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<DstSystemDTO> dstsystemdtos) {
dstsystemService.updateBatch(dstsystemMapping.toDomain(dstsystemdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-DstSystem-Remove-all')")
@ApiOperation(value = "删除系统", tags = {"系统" }, notes = "删除系统")
@RequestMapping(method = RequestMethod.DELETE, value = "/dstsystems/{dstsystem_id}")
public ResponseEntity<Boolean> remove(@PathVariable("dstsystem_id") String dstsystem_id) {
return ResponseEntity.status(HttpStatus.OK).body(dstsystemService.remove(dstsystem_id));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-DstSystem-Remove-all')")
@ApiOperation(value = "批量删除系统", tags = {"系统" }, notes = "批量删除系统")
@RequestMapping(method = RequestMethod.DELETE, value = "/dstsystems/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
dstsystemService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-DstSystem-Get-all')")
@ApiOperation(value = "获取系统", tags = {"系统" }, notes = "获取系统")
@RequestMapping(method = RequestMethod.GET, value = "/dstsystems/{dstsystem_id}")
public ResponseEntity<DstSystemDTO> get(@PathVariable("dstsystem_id") String dstsystem_id) {
DstSystem domain = dstsystemService.get(dstsystem_id);
DstSystemDTO dto = dstsystemMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "获取系统草稿", tags = {"系统" }, notes = "获取系统草稿")
@RequestMapping(method = RequestMethod.GET, value = "/dstsystems/getdraft")
public ResponseEntity<DstSystemDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(dstsystemMapping.toDto(dstsystemService.getDraft(new DstSystem())));
}
@ApiOperation(value = "检查系统", tags = {"系统" }, notes = "检查系统")
@RequestMapping(method = RequestMethod.POST, value = "/dstsystems/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody DstSystemDTO dstsystemdto) {
return ResponseEntity.status(HttpStatus.OK).body(dstsystemService.checkKey(dstsystemMapping.toDomain(dstsystemdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-DstSystem-Save-all')")
@ApiOperation(value = "保存系统", tags = {"系统" }, notes = "保存系统")
@RequestMapping(method = RequestMethod.POST, value = "/dstsystems/save")
public ResponseEntity<Boolean> save(@RequestBody DstSystemDTO dstsystemdto) {
return ResponseEntity.status(HttpStatus.OK).body(dstsystemService.save(dstsystemMapping.toDomain(dstsystemdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-DstSystem-Save-all')")
@ApiOperation(value = "批量保存系统", tags = {"系统" }, notes = "批量保存系统")
@RequestMapping(method = RequestMethod.POST, value = "/dstsystems/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<DstSystemDTO> dstsystemdtos) {
dstsystemService.saveBatch(dstsystemMapping.toDomain(dstsystemdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-DstSystem-searchDefault-all')")
@ApiOperation(value = "获取数据集", tags = {"系统" } ,notes = "获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/dstsystems/fetchdefault")
public ResponseEntity<List<DstSystemDTO>> fetchDefault(DstSystemSearchContext context) {
Page<DstSystem> domains = dstsystemService.searchDefault(context) ;
List<DstSystemDTO> list = dstsystemMapping.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','ibzlite-DstSystem-searchDefault-all')")
@ApiOperation(value = "查询数据集", tags = {"系统" } ,notes = "查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/dstsystems/searchdefault")
public ResponseEntity<Page<DstSystemDTO>> searchDefault(@RequestBody DstSystemSearchContext context) {
Page<DstSystem> domains = dstsystemService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(dstsystemMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册