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

jackwang 部署微服务接口

上级 7c799b07
package cn.ibizlab.humanresource.hrapi.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 cn.ibizlab.humanresource.util.domain.DTOBase;
import cn.ibizlab.humanresource.util.domain.DTOClient;
import lombok.Data;
/**
* 服务DTO对象[HREmpStateDTO]
*/
@Data
public class HREmpStateDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性 [CREATEMAN]
*
*/
@JSONField(name = "createman")
@JsonProperty("createman")
private String createman;
/**
* 属性 [HREMPSTATEID]
*
*/
@JSONField(name = "hrempstateid")
@JsonProperty("hrempstateid")
private String hrempstateid;
/**
* 属性 [HREMPSTATENAME]
*
*/
@JSONField(name = "hrempstatename")
@JsonProperty("hrempstatename")
private String hrempstatename;
/**
* 属性 [UPDATEMAN]
*
*/
@JSONField(name = "updateman")
@JsonProperty("updateman")
private String updateman;
/**
* 属性 [UPDATEDATE]
*
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "updatedate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("updatedate")
private Timestamp updatedate;
/**
* 属性 [CREATEDATE]
*
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "createdate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("createdate")
private Timestamp createdate;
/**
* 属性 [JOBSTATE]
*
*/
@JSONField(name = "jobstate")
@JsonProperty("jobstate")
private String jobstate;
/**
* 属性 [SHOWORDER]
*
*/
@JSONField(name = "showorder")
@JsonProperty("showorder")
private BigInteger showorder;
/**
* 属性 [STATECODE]
*
*/
@JSONField(name = "statecode")
@JsonProperty("statecode")
private String statecode;
/**
* 设置 [HREMPSTATENAME]
*/
public void setHrempstatename(String hrempstatename){
this.hrempstatename = hrempstatename ;
this.modify("hrempstatename",hrempstatename);
}
/**
* 设置 [JOBSTATE]
*/
public void setJobstate(String jobstate){
this.jobstate = jobstate ;
this.modify("jobstate",jobstate);
}
/**
* 设置 [SHOWORDER]
*/
public void setShoworder(BigInteger showorder){
this.showorder = showorder ;
this.modify("showorder",showorder);
}
/**
* 设置 [STATECODE]
*/
public void setStatecode(String statecode){
this.statecode = statecode ;
this.modify("statecode",statecode);
}
}
package cn.ibizlab.humanresource.hrapi.mapping;
import org.mapstruct.*;
import cn.ibizlab.humanresource.core.humanresource.domain.HREmpState;
import cn.ibizlab.humanresource.hrapi.dto.HREmpStateDTO;
import cn.ibizlab.humanresource.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},implementationName="HRApiHREmpStateMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface HREmpStateMapping extends MappingBase<HREmpStateDTO, HREmpState> {
}
package cn.ibizlab.humanresource.hrapi.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.transaction.annotation.Transactional;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.humanresource.hrapi.dto.*;
import cn.ibizlab.humanresource.hrapi.mapping.*;
import cn.ibizlab.humanresource.core.humanresource.domain.HREmpState;
import cn.ibizlab.humanresource.core.humanresource.service.IHREmpStateService;
import cn.ibizlab.humanresource.core.humanresource.filter.HREmpStateSearchContext;
import cn.ibizlab.humanresource.util.annotation.VersionCheck;
@Slf4j
@Api(tags = {"员工状态" })
@RestController("HRApi-hrempstate")
@RequestMapping("")
public class HREmpStateResource {
@Autowired
public IHREmpStateService hrempstateService;
@Autowired
@Lazy
public HREmpStateMapping hrempstateMapping;
@PreAuthorize("hasPermission(this.hrempstateMapping.toDomain(#hrempstatedto),'iBizHumanResources-HREmpState-Create')")
@ApiOperation(value = "新建员工状态", tags = {"员工状态" }, notes = "新建员工状态")
@RequestMapping(method = RequestMethod.POST, value = "/hrempstates")
@Transactional
public ResponseEntity<HREmpStateDTO> create(@RequestBody HREmpStateDTO hrempstatedto) {
HREmpState domain = hrempstateMapping.toDomain(hrempstatedto);
hrempstateService.create(domain);
HREmpStateDTO dto = hrempstateMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.hrempstateMapping.toDomain(#hrempstatedtos),'iBizHumanResources-HREmpState-Create')")
@ApiOperation(value = "批量新建员工状态", tags = {"员工状态" }, notes = "批量新建员工状态")
@RequestMapping(method = RequestMethod.POST, value = "/hrempstates/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<HREmpStateDTO> hrempstatedtos) {
hrempstateService.createBatch(hrempstateMapping.toDomain(hrempstatedtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@VersionCheck(entity = "hrempstate" , versionfield = "updatedate")
@PreAuthorize("hasPermission(this.hrempstateService.get(#hrempstate_id),'iBizHumanResources-HREmpState-Update')")
@ApiOperation(value = "更新员工状态", tags = {"员工状态" }, notes = "更新员工状态")
@RequestMapping(method = RequestMethod.PUT, value = "/hrempstates/{hrempstate_id}")
@Transactional
public ResponseEntity<HREmpStateDTO> update(@PathVariable("hrempstate_id") String hrempstate_id, @RequestBody HREmpStateDTO hrempstatedto) {
HREmpState domain = hrempstateMapping.toDomain(hrempstatedto);
domain .setHrempstateid(hrempstate_id);
hrempstateService.update(domain );
HREmpStateDTO dto = hrempstateMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.hrempstateService.getHrempstateByEntities(this.hrempstateMapping.toDomain(#hrempstatedtos)),'iBizHumanResources-HREmpState-Update')")
@ApiOperation(value = "批量更新员工状态", tags = {"员工状态" }, notes = "批量更新员工状态")
@RequestMapping(method = RequestMethod.PUT, value = "/hrempstates/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<HREmpStateDTO> hrempstatedtos) {
hrempstateService.updateBatch(hrempstateMapping.toDomain(hrempstatedtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.hrempstateService.get(#hrempstate_id),'iBizHumanResources-HREmpState-Remove')")
@ApiOperation(value = "删除员工状态", tags = {"员工状态" }, notes = "删除员工状态")
@RequestMapping(method = RequestMethod.DELETE, value = "/hrempstates/{hrempstate_id}")
@Transactional
public ResponseEntity<Boolean> remove(@PathVariable("hrempstate_id") String hrempstate_id) {
return ResponseEntity.status(HttpStatus.OK).body(hrempstateService.remove(hrempstate_id));
}
@PreAuthorize("hasPermission(this.hrempstateService.getHrempstateByIds(#ids),'iBizHumanResources-HREmpState-Remove')")
@ApiOperation(value = "批量删除员工状态", tags = {"员工状态" }, notes = "批量删除员工状态")
@RequestMapping(method = RequestMethod.DELETE, value = "/hrempstates/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
hrempstateService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PostAuthorize("hasPermission(this.hrempstateMapping.toDomain(returnObject.body),'iBizHumanResources-HREmpState-Get')")
@ApiOperation(value = "获取员工状态", tags = {"员工状态" }, notes = "获取员工状态")
@RequestMapping(method = RequestMethod.GET, value = "/hrempstates/{hrempstate_id}")
public ResponseEntity<HREmpStateDTO> get(@PathVariable("hrempstate_id") String hrempstate_id) {
HREmpState domain = hrempstateService.get(hrempstate_id);
HREmpStateDTO dto = hrempstateMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "获取员工状态草稿", tags = {"员工状态" }, notes = "获取员工状态草稿")
@RequestMapping(method = RequestMethod.GET, value = "/hrempstates/getdraft")
public ResponseEntity<HREmpStateDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(hrempstateMapping.toDto(hrempstateService.getDraft(new HREmpState())));
}
@ApiOperation(value = "检查员工状态", tags = {"员工状态" }, notes = "检查员工状态")
@RequestMapping(method = RequestMethod.POST, value = "/hrempstates/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody HREmpStateDTO hrempstatedto) {
return ResponseEntity.status(HttpStatus.OK).body(hrempstateService.checkKey(hrempstateMapping.toDomain(hrempstatedto)));
}
@PreAuthorize("hasPermission(this.hrempstateMapping.toDomain(#hrempstatedto),'iBizHumanResources-HREmpState-Save')")
@ApiOperation(value = "保存员工状态", tags = {"员工状态" }, notes = "保存员工状态")
@RequestMapping(method = RequestMethod.POST, value = "/hrempstates/save")
public ResponseEntity<Boolean> save(@RequestBody HREmpStateDTO hrempstatedto) {
return ResponseEntity.status(HttpStatus.OK).body(hrempstateService.save(hrempstateMapping.toDomain(hrempstatedto)));
}
@PreAuthorize("hasPermission(this.hrempstateMapping.toDomain(#hrempstatedtos),'iBizHumanResources-HREmpState-Save')")
@ApiOperation(value = "批量保存员工状态", tags = {"员工状态" }, notes = "批量保存员工状态")
@RequestMapping(method = RequestMethod.POST, value = "/hrempstates/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<HREmpStateDTO> hrempstatedtos) {
hrempstateService.saveBatch(hrempstateMapping.toDomain(hrempstatedtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizHumanResources-HREmpState-searchDefault-all') and hasPermission(#context,'iBizHumanResources-HREmpState-Get')")
@ApiOperation(value = "获取DEFAULT", tags = {"员工状态" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/hrempstates/fetchdefault")
public ResponseEntity<List<HREmpStateDTO>> fetchDefault(HREmpStateSearchContext context) {
Page<HREmpState> domains = hrempstateService.searchDefault(context) ;
List<HREmpStateDTO> list = hrempstateMapping.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','iBizHumanResources-HREmpState-searchDefault-all') and hasPermission(#context,'iBizHumanResources-HREmpState-Get')")
@ApiOperation(value = "查询DEFAULT", tags = {"员工状态" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/hrempstates/searchdefault")
public ResponseEntity<Page<HREmpStateDTO>> searchDefault(@RequestBody HREmpStateSearchContext context) {
Page<HREmpState> domains = hrempstateService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(hrempstateMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册