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

jackwang 部署微服务接口

上级 ea5a5240
......@@ -39,6 +39,10 @@ zuul:
path: /hromhierarchies/**
serviceId: ${ibiz.ref.service.ibizhumanresources-hrapi:ibizhumanresources-hrapi}
stripPrefix: false
hrdistribution:
path: /hrdistributions/**
serviceId: ${ibiz.ref.service.ibizhumanresources-hrapi:ibizhumanresources-hrapi}
stripPrefix: false
hrorgaddress:
path: /hrorgaddresses/**
serviceId: ${ibiz.ref.service.ibizhumanresources-hrapi:ibizhumanresources-hrapi}
......@@ -55,5 +59,9 @@ zuul:
path: /hrduties/**
serviceId: ${ibiz.ref.service.ibizhumanresources-hrapi:ibizhumanresources-hrapi}
stripPrefix: false
hrpostrel:
path: /hrpostrels/**
serviceId: ${ibiz.ref.service.ibizhumanresources-hrapi:ibizhumanresources-hrapi}
stripPrefix: false
sensitive-headers:
- Cookie,Set-Cookie,Authorization
......@@ -104,7 +104,7 @@ public class HRDistribution extends EntityMP implements Serializable {
@JsonProperty("hremployeename")
private String hremployeename;
/**
* 开始时间
* 入职时间
*/
@TableField(value = "begintime")
@JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8")
......@@ -112,7 +112,7 @@ public class HRDistribution extends EntityMP implements Serializable {
@JsonProperty("begintime")
private Timestamp begintime;
/**
* 结束时间
* 离职时间
*/
@TableField(value = "endtime")
@JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8")
......@@ -169,7 +169,7 @@ public class HRDistribution extends EntityMP implements Serializable {
}
/**
* 设置 [开始时间]
* 设置 [入职时间]
*/
public void setBegintime(Timestamp begintime){
this.begintime = begintime ;
......@@ -177,7 +177,7 @@ public class HRDistribution extends EntityMP implements Serializable {
}
/**
* 格式化日期 [开始时间]
* 格式化日期 [入职时间]
*/
public String formatBegintime(){
if (this.begintime == null) {
......@@ -187,7 +187,7 @@ public class HRDistribution extends EntityMP implements Serializable {
return sdf.format(begintime);
}
/**
* 设置 [结束时间]
* 设置 [离职时间]
*/
public void setEndtime(Timestamp endtime){
this.endtime = endtime ;
......@@ -195,7 +195,7 @@ public class HRDistribution extends EntityMP implements Serializable {
}
/**
* 格式化日期 [结束时间]
* 格式化日期 [离职时间]
*/
public String formatEndtime(){
if (this.endtime == null) {
......
......@@ -89,6 +89,66 @@ public class HRPostRel extends EntityMP implements Serializable {
@JSONField(name = "updatedate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("updatedate")
private Timestamp updatedate;
/**
* 职位标识
*/
@TableField(value = "hrpostid")
@JSONField(name = "hrpostid")
@JsonProperty("hrpostid")
private String hrpostid;
/**
* 职位
*/
@TableField(exist = false)
@JSONField(name = "hrpostname")
@JsonProperty("hrpostname")
private String hrpostname;
/**
* 职位标识
*/
@TableField(value = "phrpostid")
@JSONField(name = "phrpostid")
@JsonProperty("phrpostid")
private String phrpostid;
/**
* 职位
*/
@TableField(exist = false)
@JSONField(name = "phrpostname")
@JsonProperty("phrpostname")
private String phrpostname;
/**
* 生效
*/
@TableField(value = "begintime")
@JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8")
@JSONField(name = "begintime" , format="yyyy-MM-dd")
@JsonProperty("begintime")
private Timestamp begintime;
/**
* 到期
*/
@TableField(value = "endtime")
@JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8")
@JSONField(name = "endtime" , format="yyyy-MM-dd")
@JsonProperty("endtime")
private Timestamp endtime;
/**
* 职位
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.humanresource.core.humanresource.domain.HRPost hrpost;
/**
* 直接上级职位
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private cn.ibizlab.humanresource.core.humanresource.domain.HRPost phrpost;
......@@ -100,6 +160,58 @@ public class HRPostRel extends EntityMP implements Serializable {
this.modify("hrpostrelname",hrpostrelname);
}
/**
* 设置 [职位标识]
*/
public void setHrpostid(String hrpostid){
this.hrpostid = hrpostid ;
this.modify("hrpostid",hrpostid);
}
/**
* 设置 [职位标识]
*/
public void setPhrpostid(String phrpostid){
this.phrpostid = phrpostid ;
this.modify("phrpostid",phrpostid);
}
/**
* 设置 [生效]
*/
public void setBegintime(Timestamp begintime){
this.begintime = begintime ;
this.modify("begintime",begintime);
}
/**
* 格式化日期 [生效]
*/
public String formatBegintime(){
if (this.begintime == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(begintime);
}
/**
* 设置 [到期]
*/
public void setEndtime(Timestamp endtime){
this.endtime = endtime ;
this.modify("endtime",endtime);
}
/**
* 格式化日期 [到期]
*/
public String formatEndtime(){
if (this.endtime == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(endtime);
}
}
......
......@@ -34,6 +34,48 @@ public class HRPostRelSearchContext extends QueryWrapperContext<HRPostRel> {
this.getSearchCond().like("hrpostrelname", n_hrpostrelname_like);
}
}
private String n_hrpostid_eq;//[职位标识]
public void setN_hrpostid_eq(String n_hrpostid_eq) {
this.n_hrpostid_eq = n_hrpostid_eq;
if(!ObjectUtils.isEmpty(this.n_hrpostid_eq)){
this.getSearchCond().eq("hrpostid", n_hrpostid_eq);
}
}
private String n_hrpostname_eq;//[职位]
public void setN_hrpostname_eq(String n_hrpostname_eq) {
this.n_hrpostname_eq = n_hrpostname_eq;
if(!ObjectUtils.isEmpty(this.n_hrpostname_eq)){
this.getSearchCond().eq("hrpostname", n_hrpostname_eq);
}
}
private String n_hrpostname_like;//[职位]
public void setN_hrpostname_like(String n_hrpostname_like) {
this.n_hrpostname_like = n_hrpostname_like;
if(!ObjectUtils.isEmpty(this.n_hrpostname_like)){
this.getSearchCond().like("hrpostname", n_hrpostname_like);
}
}
private String n_phrpostid_eq;//[职位标识]
public void setN_phrpostid_eq(String n_phrpostid_eq) {
this.n_phrpostid_eq = n_phrpostid_eq;
if(!ObjectUtils.isEmpty(this.n_phrpostid_eq)){
this.getSearchCond().eq("phrpostid", n_phrpostid_eq);
}
}
private String n_phrpostname_eq;//[职位]
public void setN_phrpostname_eq(String n_phrpostname_eq) {
this.n_phrpostname_eq = n_phrpostname_eq;
if(!ObjectUtils.isEmpty(this.n_phrpostname_eq)){
this.getSearchCond().eq("phrpostname", n_phrpostname_eq);
}
}
private String n_phrpostname_like;//[职位]
public void setN_phrpostname_like(String n_phrpostname_like) {
this.n_phrpostname_like = n_phrpostname_like;
if(!ObjectUtils.isEmpty(this.n_phrpostname_like)){
this.getSearchCond().like("phrpostname", n_phrpostname_like);
}
}
/**
* 启用快速搜索
......
......@@ -62,4 +62,8 @@ public interface HRPostRelMapper extends BaseMapper<HRPostRel>{
@Delete("${sql}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
List<HRPostRel> selectByHrpostid(@Param("hrpostid") Serializable hrpostid) ;
List<HRPostRel> selectByPhrpostid(@Param("hrpostid") Serializable hrpostid) ;
}
......@@ -37,6 +37,10 @@ public interface IHRPostRelService extends IService<HRPostRel>{
boolean save(HRPostRel et) ;
void saveBatch(List<HRPostRel> list) ;
Page<HRPostRel> searchDefault(HRPostRelSearchContext context) ;
List<HRPostRel> selectByHrpostid(String hrpostid) ;
void removeByHrpostid(String hrpostid) ;
List<HRPostRel> selectByPhrpostid(String hrpostid) ;
void removeByPhrpostid(String hrpostid) ;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
......
......@@ -45,12 +45,16 @@ import org.springframework.util.StringUtils;
@Service("HRPostRelServiceImpl")
public class HRPostRelServiceImpl extends ServiceImpl<HRPostRelMapper, HRPostRel> implements IHRPostRelService {
@Autowired
@Lazy
protected cn.ibizlab.humanresource.core.humanresource.service.IHRPostService hrpostService;
protected int batchSize = 500;
@Override
@Transactional
public boolean create(HRPostRel et) {
fillParentData(et);
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getHrpostrelid()),et);
......@@ -59,12 +63,14 @@ public class HRPostRelServiceImpl extends ServiceImpl<HRPostRelMapper, HRPostRel
@Override
public void createBatch(List<HRPostRel> list) {
list.forEach(item->fillParentData(item));
this.saveBatch(list,batchSize);
}
@Override
@Transactional
public boolean update(HRPostRel et) {
fillParentData(et);
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("hrpostrelid",et.getHrpostrelid())))
return false;
CachedBeanCopier.copy(get(et.getHrpostrelid()),et);
......@@ -73,6 +79,7 @@ public class HRPostRelServiceImpl extends ServiceImpl<HRPostRelMapper, HRPostRel
@Override
public void updateBatch(List<HRPostRel> list) {
list.forEach(item->fillParentData(item));
updateBatchById(list,batchSize);
}
......@@ -103,6 +110,7 @@ public class HRPostRelServiceImpl extends ServiceImpl<HRPostRelMapper, HRPostRel
@Override
public HRPostRel getDraft(HRPostRel et) {
fillParentData(et);
return et;
}
......@@ -130,16 +138,38 @@ public class HRPostRelServiceImpl extends ServiceImpl<HRPostRelMapper, HRPostRel
@Override
public boolean saveBatch(Collection<HRPostRel> list) {
list.forEach(item->fillParentData(item));
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
public void saveBatch(List<HRPostRel> list) {
list.forEach(item->fillParentData(item));
saveOrUpdateBatch(list,batchSize);
}
@Override
public List<HRPostRel> selectByHrpostid(String hrpostid) {
return baseMapper.selectByHrpostid(hrpostid);
}
@Override
public void removeByHrpostid(String hrpostid) {
this.remove(new QueryWrapper<HRPostRel>().eq("hrpostid",hrpostid));
}
@Override
public List<HRPostRel> selectByPhrpostid(String hrpostid) {
return baseMapper.selectByPhrpostid(hrpostid);
}
@Override
public void removeByPhrpostid(String hrpostid) {
this.remove(new QueryWrapper<HRPostRel>().eq("phrpostid",hrpostid));
}
/**
* 查询集合 DEFAULT
......@@ -152,6 +182,32 @@ public class HRPostRelServiceImpl extends ServiceImpl<HRPostRelMapper, HRPostRel
/**
* 为当前实体填充父数据(外键值文本、外键值附加数据)
* @param et
*/
private void fillParentData(HRPostRel et){
//实体关系[DER1N_HRPOSTREL_HRPOST_HRPOSTID]
if(!ObjectUtils.isEmpty(et.getHrpostid())){
cn.ibizlab.humanresource.core.humanresource.domain.HRPost hrpost=et.getHrpost();
if(ObjectUtils.isEmpty(hrpost)){
cn.ibizlab.humanresource.core.humanresource.domain.HRPost majorEntity=hrpostService.get(et.getHrpostid());
et.setHrpost(majorEntity);
hrpost=majorEntity;
}
et.setHrpostname(hrpost.getHrpostname());
}
//实体关系[DER1N_HRPOSTREL_HRPOST_PHRPOSTID]
if(!ObjectUtils.isEmpty(et.getPhrpostid())){
cn.ibizlab.humanresource.core.humanresource.domain.HRPost phrpost=et.getPhrpost();
if(ObjectUtils.isEmpty(phrpost)){
cn.ibizlab.humanresource.core.humanresource.domain.HRPost majorEntity=hrpostService.get(et.getPhrpostid());
et.setPhrpost(majorEntity);
phrpost=majorEntity;
}
et.setPhrpostname(phrpost.getHrpostname());
}
}
......
......@@ -50,6 +50,9 @@ public class HRPostServiceImpl extends ServiceImpl<HRPostMapper, HRPost> impleme
protected cn.ibizlab.humanresource.core.humanresource.service.IHRDistributionService hrdistributionService;
@Autowired
@Lazy
protected cn.ibizlab.humanresource.core.humanresource.service.IHRPostRelService hrpostrelService;
@Autowired
@Lazy
protected cn.ibizlab.humanresource.core.humanresource.service.IHRDutyService hrdutyService;
@Autowired
@Lazy
......
......@@ -24,7 +24,7 @@
<!--输出实体[HRDISTRIBUTION]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-hrdistribution-11-2">
<changeSet author="a_LAB01_e85d8801c" id="tab-hrdistribution-16-2">
<createTable tableName="T_HRDISTRIBUTION">
<column name="UPDATEMAN" remarks="" type="VARCHAR(60)">
</column>
......@@ -346,7 +346,7 @@
<!--输出实体[HRPOST]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-hrpost-47-15">
<changeSet author="a_LAB01_e85d8801c" id="tab-hrpost-95-15">
<createTable tableName="T_HRPOST">
<column name="HRPOSTID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_HRPOST_HRPOSTID"/>
......@@ -380,7 +380,7 @@
<!--输出实体[HRPOSTREL]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-hrpostrel-2-16">
<changeSet author="a_LAB01_e85d8801c" id="tab-hrpostrel-11-16">
<createTable tableName="T_HRPOSTREL">
<column name="CREATEMAN" remarks="" type="VARCHAR(60)">
</column>
......@@ -395,15 +395,23 @@
</column>
<column name="UPDATEDATE" remarks="" type="DATETIME">
</column>
<column name="HRPOSTID" remarks="" type="VARCHAR(100)">
</column>
<column name="PHRPOSTID" remarks="" type="VARCHAR(100)">
</column>
<column name="BEGINTIME" remarks="" type="DATETIME">
</column>
<column name="ENDTIME" remarks="" type="DATETIME">
</column>
</createTable>
</changeSet>
<!--输出实体[HRATTENDANCE]外键关系 -->
<!--输出实体[HRDISTRIBUTION]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-hrdistribution-11-17">
<changeSet author="a_LAB01_e85d8801c" id="fk-hrdistribution-16-17">
<addForeignKeyConstraint baseColumnNames="HREMPLOYEEID" baseTableName="T_HRDISTRIBUTION" constraintName="DER1N_HRDISTRIBUTION_HREMPLOYE" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="EMPLOYEEID" referencedTableName="EMPLOYEE" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-hrdistribution-11-18">
<changeSet author="a_LAB01_e85d8801c" id="fk-hrdistribution-16-18">
<addForeignKeyConstraint baseColumnNames="HRPOSTID" baseTableName="T_HRDISTRIBUTION" constraintName="DER1N_HRDISTRIBUTION_HRPOST_HR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="HRPOSTID" referencedTableName="T_HRPOST" validate="true"/>
</changeSet>
<!--输出实体[HRDUTY]外键关系 -->
......@@ -440,12 +448,18 @@
</changeSet>
<!--输出实体[HRORGANIZATION]外键关系 -->
<!--输出实体[HRPOST]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-hrpost-47-27">
<changeSet author="a_LAB01_e85d8801c" id="fk-hrpost-95-27">
<addForeignKeyConstraint baseColumnNames="HRDUTYID" baseTableName="T_HRPOST" constraintName="DER1N_HRPOST_HRDUTY_HRDUTYID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="HRDUTYID" referencedTableName="T_HRDUTY" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-hrpost-47-28">
<changeSet author="a_LAB01_e85d8801c" id="fk-hrpost-95-28">
<addForeignKeyConstraint baseColumnNames="HRORGANIZATIONID" baseTableName="T_HRPOST" constraintName="DER1N_HRPOST_HRORGANIZATION_HR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGANIZATIONID" referencedTableName="ORGANIZATION" validate="true"/>
</changeSet>
<!--输出实体[HRPOSTREL]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-hrpostrel-11-29">
<addForeignKeyConstraint baseColumnNames="HRPOSTID" baseTableName="T_HRPOSTREL" constraintName="DER1N_HRPOSTREL_HRPOST_HRPOSTI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="HRPOSTID" referencedTableName="T_HRPOST" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-hrpostrel-11-30">
<addForeignKeyConstraint baseColumnNames="PHRPOSTID" baseTableName="T_HRPOSTREL" constraintName="DER1N_HRPOSTREL_HRPOST_PHRPOST" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="HRPOSTID" referencedTableName="T_HRPOST" validate="true"/>
</changeSet>
</databaseChangeLog>
......@@ -5,16 +5,36 @@
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="HRPostRelResultMap" databaseId="mysql">
<![CDATA[select t1.* from (SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`HRPOSTRELID`, t1.`HRPOSTRELNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_HRPOSTREL` t1 ) t1 where hrpostrelid=#{id}]]>
<![CDATA[select t1.* from (SELECT t1.`BEGINTIME`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`ENDTIME`, t1.`HRPOSTID`, t11.`HRPOSTNAME`, t1.`HRPOSTRELID`, t1.`HRPOSTRELNAME`, t1.`PHRPOSTID`, t21.`HRPOSTNAME` AS `PHRPOSTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_HRPOSTREL` t1 LEFT JOIN T_HRPOST t11 ON t1.HRPOSTID = t11.HRPOSTID LEFT JOIN T_HRPOST t21 ON t1.PHRPOSTID = t21.HRPOSTID ) t1 where hrpostrelid=#{id}]]>
</select>
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="HRPostRelResultMap" type="cn.ibizlab.humanresource.core.humanresource.domain.HRPostRel" autoMapping="true">
<id property="hrpostrelid" column="hrpostrelid" /><!--主键字段映射-->
<result property="hrpostid" column="hrpostid" />
<result property="phrpostid" column="phrpostid" />
<!--通过mybatis自动注入关系属性[主实体],fetchType="lazy"为懒加载配置 -->
<association property="hrpost" javaType="cn.ibizlab.humanresource.core.humanresource.domain.HRPost" column="hrpostid" select="cn.ibizlab.humanresource.core.humanresource.mapper.HRPostMapper.selectById" fetchType="lazy"></association>
<!--通过mybatis自动注入关系属性[主实体],fetchType="lazy"为懒加载配置 -->
<association property="phrpost" javaType="cn.ibizlab.humanresource.core.humanresource.domain.HRPost" column="phrpostid" select="cn.ibizlab.humanresource.core.humanresource.mapper.HRPostMapper.selectById" fetchType="lazy"></association>
</resultMap>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_HRPOSTREL_HRPOST_HRPOSTID] -->
<select id="selectByHrpostid" resultMap="HRPostRelResultMap">
select t1.* from (
<include refid="Default" />
) t1
where hrpostid=#{hrpostid}
</select>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_HRPOSTREL_HRPOST_PHRPOSTID] -->
<select id="selectByPhrpostid" resultMap="HRPostRelResultMap">
select t1.* from (
<include refid="Default" />
) t1
where phrpostid=#{hrpostid}
</select>
<!--数据集合[Default]-->
<select id="searchDefault" parameterType="cn.ibizlab.humanresource.core.humanresource.filter.HRPostRelSearchContext" resultMap="HRPostRelResultMap">
......@@ -27,12 +47,12 @@
<!--数据查询[Default]-->
<sql id="Default" databaseId="mysql">
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`HRPOSTRELID`, t1.`HRPOSTRELNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_HRPOSTREL` t1
<![CDATA[ SELECT t1.`BEGINTIME`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`ENDTIME`, t1.`HRPOSTID`, t11.`HRPOSTNAME`, t1.`HRPOSTRELID`, t1.`HRPOSTRELNAME`, t1.`PHRPOSTID`, t21.`HRPOSTNAME` AS `PHRPOSTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_HRPOSTREL` t1 LEFT JOIN T_HRPOST t11 ON t1.HRPOSTID = t11.HRPOSTID LEFT JOIN T_HRPOST t21 ON t1.PHRPOSTID = t21.HRPOSTID
]]>
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="mysql">
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`HRPOSTRELID`, t1.`HRPOSTRELNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_HRPOSTREL` t1
<![CDATA[ SELECT t1.`BEGINTIME`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`ENDTIME`, t1.`HRPOSTID`, t11.`HRPOSTNAME`, t1.`HRPOSTRELID`, t1.`HRPOSTRELNAME`, t1.`PHRPOSTID`, t21.`HRPOSTNAME` AS `PHRPOSTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_HRPOSTREL` t1 LEFT JOIN T_HRPOST t11 ON t1.HRPOSTID = t11.HRPOSTID LEFT JOIN T_HRPOST t21 ON t1.PHRPOSTID = t21.HRPOSTID
]]>
</sql>
</mapper>
......
......@@ -68,6 +68,14 @@
"datascope":[{"id":"all","name":"全部数据"}, {"id":"createman","name":"创建人"}]
}
, {
"dename":"HRDistribution",
"delogicname":"工作人员分配",
"sysmoudle":{"id":"HUMANRESOURCE","name":"人力"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}, {"id":"createman","name":"创建人"}]
}
, {
"dename":"HROrgAddress",
"delogicname":"组织地址",
"sysmoudle":{"id":"BASE","name":"基础"},
......@@ -97,6 +105,14 @@
"sysmoudle":{"id":"HUMANRESOURCE","name":"人力"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}, {"id":"createman","name":"创建人"}]
}
, {
"dename":"HRPostRel",
"delogicname":"职位关系",
"sysmoudle":{"id":"HUMANRESOURCE","name":"人力"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}, {"id":"createman","name":"创建人"}]
}
],
......
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对象[HRDistributionDTO]
*/
@Data
public class HRDistributionDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性 [UPDATEMAN]
*
*/
@JSONField(name = "updateman")
@JsonProperty("updateman")
private String updateman;
/**
* 属性 [HRDISTRIBUTIONNAME]
*
*/
@JSONField(name = "hrdistributionname")
@JsonProperty("hrdistributionname")
private String hrdistributionname;
/**
* 属性 [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;
/**
* 属性 [HRDISTRIBUTIONID]
*
*/
@JSONField(name = "hrdistributionid")
@JsonProperty("hrdistributionid")
private String hrdistributionid;
/**
* 属性 [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;
/**
* 属性 [CREATEMAN]
*
*/
@JSONField(name = "createman")
@JsonProperty("createman")
private String createman;
/**
* 属性 [HREMPLOYEEID]
*
*/
@JSONField(name = "hremployeeid")
@JsonProperty("hremployeeid")
private String hremployeeid;
/**
* 属性 [HREMPLOYEENAME]
*
*/
@JSONField(name = "hremployeename")
@JsonProperty("hremployeename")
private String hremployeename;
/**
* 属性 [BEGINTIME]
*
*/
@JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8")
@JSONField(name = "begintime" , format="yyyy-MM-dd")
@JsonProperty("begintime")
private Timestamp begintime;
/**
* 属性 [ENDTIME]
*
*/
@JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8")
@JSONField(name = "endtime" , format="yyyy-MM-dd")
@JsonProperty("endtime")
private Timestamp endtime;
/**
* 属性 [HRPOSTID]
*
*/
@JSONField(name = "hrpostid")
@JsonProperty("hrpostid")
private String hrpostid;
/**
* 属性 [HRPOSTNAME]
*
*/
@JSONField(name = "hrpostname")
@JsonProperty("hrpostname")
private String hrpostname;
/**
* 设置 [HRDISTRIBUTIONNAME]
*/
public void setHrdistributionname(String hrdistributionname){
this.hrdistributionname = hrdistributionname ;
this.modify("hrdistributionname",hrdistributionname);
}
/**
* 设置 [HREMPLOYEEID]
*/
public void setHremployeeid(String hremployeeid){
this.hremployeeid = hremployeeid ;
this.modify("hremployeeid",hremployeeid);
}
/**
* 设置 [BEGINTIME]
*/
public void setBegintime(Timestamp begintime){
this.begintime = begintime ;
this.modify("begintime",begintime);
}
/**
* 设置 [ENDTIME]
*/
public void setEndtime(Timestamp endtime){
this.endtime = endtime ;
this.modify("endtime",endtime);
}
/**
* 设置 [HRPOSTID]
*/
public void setHrpostid(String hrpostid){
this.hrpostid = hrpostid ;
this.modify("hrpostid",hrpostid);
}
}
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对象[HRPostRelDTO]
*/
@Data
public class HRPostRelDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性 [CREATEMAN]
*
*/
@JSONField(name = "createman")
@JsonProperty("createman")
private String createman;
/**
* 属性 [HRPOSTRELNAME]
*
*/
@JSONField(name = "hrpostrelname")
@JsonProperty("hrpostrelname")
private String hrpostrelname;
/**
* 属性 [HRPOSTRELID]
*
*/
@JSONField(name = "hrpostrelid")
@JsonProperty("hrpostrelid")
private String hrpostrelid;
/**
* 属性 [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;
/**
* 属性 [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;
/**
* 属性 [HRPOSTID]
*
*/
@JSONField(name = "hrpostid")
@JsonProperty("hrpostid")
private String hrpostid;
/**
* 属性 [HRPOSTNAME]
*
*/
@JSONField(name = "hrpostname")
@JsonProperty("hrpostname")
private String hrpostname;
/**
* 属性 [PHRPOSTID]
*
*/
@JSONField(name = "phrpostid")
@JsonProperty("phrpostid")
private String phrpostid;
/**
* 属性 [PHRPOSTNAME]
*
*/
@JSONField(name = "phrpostname")
@JsonProperty("phrpostname")
private String phrpostname;
/**
* 属性 [BEGINTIME]
*
*/
@JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8")
@JSONField(name = "begintime" , format="yyyy-MM-dd")
@JsonProperty("begintime")
private Timestamp begintime;
/**
* 属性 [ENDTIME]
*
*/
@JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8")
@JSONField(name = "endtime" , format="yyyy-MM-dd")
@JsonProperty("endtime")
private Timestamp endtime;
/**
* 设置 [HRPOSTRELNAME]
*/
public void setHrpostrelname(String hrpostrelname){
this.hrpostrelname = hrpostrelname ;
this.modify("hrpostrelname",hrpostrelname);
}
/**
* 设置 [HRPOSTID]
*/
public void setHrpostid(String hrpostid){
this.hrpostid = hrpostid ;
this.modify("hrpostid",hrpostid);
}
/**
* 设置 [PHRPOSTID]
*/
public void setPhrpostid(String phrpostid){
this.phrpostid = phrpostid ;
this.modify("phrpostid",phrpostid);
}
/**
* 设置 [BEGINTIME]
*/
public void setBegintime(Timestamp begintime){
this.begintime = begintime ;
this.modify("begintime",begintime);
}
/**
* 设置 [ENDTIME]
*/
public void setEndtime(Timestamp endtime){
this.endtime = endtime ;
this.modify("endtime",endtime);
}
}
package cn.ibizlab.humanresource.hrapi.mapping;
import org.mapstruct.*;
import cn.ibizlab.humanresource.core.humanresource.domain.HRDistribution;
import cn.ibizlab.humanresource.hrapi.dto.HRDistributionDTO;
import cn.ibizlab.humanresource.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},implementationName="HRApiHRDistributionMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface HRDistributionMapping extends MappingBase<HRDistributionDTO, HRDistribution> {
}
package cn.ibizlab.humanresource.hrapi.mapping;
import org.mapstruct.*;
import cn.ibizlab.humanresource.core.humanresource.domain.HRPostRel;
import cn.ibizlab.humanresource.hrapi.dto.HRPostRelDTO;
import cn.ibizlab.humanresource.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},implementationName="HRApiHRPostRelMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface HRPostRelMapping extends MappingBase<HRPostRelDTO, HRPostRel> {
}
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.HRDistribution;
import cn.ibizlab.humanresource.core.humanresource.service.IHRDistributionService;
import cn.ibizlab.humanresource.core.humanresource.filter.HRDistributionSearchContext;
import cn.ibizlab.humanresource.util.annotation.VersionCheck;
@Slf4j
@Api(tags = {"工作人员分配" })
@RestController("HRApi-hrdistribution")
@RequestMapping("")
public class HRDistributionResource {
@Autowired
public IHRDistributionService hrdistributionService;
@Autowired
@Lazy
public HRDistributionMapping hrdistributionMapping;
@PreAuthorize("hasPermission(this.hrdistributionMapping.toDomain(#hrdistributiondto),'iBizHumanResources-HRDistribution-Create')")
@ApiOperation(value = "新建工作人员分配", tags = {"工作人员分配" }, notes = "新建工作人员分配")
@RequestMapping(method = RequestMethod.POST, value = "/hrdistributions")
@Transactional
public ResponseEntity<HRDistributionDTO> create(@RequestBody HRDistributionDTO hrdistributiondto) {
HRDistribution domain = hrdistributionMapping.toDomain(hrdistributiondto);
hrdistributionService.create(domain);
HRDistributionDTO dto = hrdistributionMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.hrdistributionMapping.toDomain(#hrdistributiondtos),'iBizHumanResources-HRDistribution-Create')")
@ApiOperation(value = "批量新建工作人员分配", tags = {"工作人员分配" }, notes = "批量新建工作人员分配")
@RequestMapping(method = RequestMethod.POST, value = "/hrdistributions/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<HRDistributionDTO> hrdistributiondtos) {
hrdistributionService.createBatch(hrdistributionMapping.toDomain(hrdistributiondtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@VersionCheck(entity = "hrdistribution" , versionfield = "updatedate")
@PreAuthorize("hasPermission(this.hrdistributionService.get(#hrdistribution_id),'iBizHumanResources-HRDistribution-Update')")
@ApiOperation(value = "更新工作人员分配", tags = {"工作人员分配" }, notes = "更新工作人员分配")
@RequestMapping(method = RequestMethod.PUT, value = "/hrdistributions/{hrdistribution_id}")
@Transactional
public ResponseEntity<HRDistributionDTO> update(@PathVariable("hrdistribution_id") String hrdistribution_id, @RequestBody HRDistributionDTO hrdistributiondto) {
HRDistribution domain = hrdistributionMapping.toDomain(hrdistributiondto);
domain .setHrdistributionid(hrdistribution_id);
hrdistributionService.update(domain );
HRDistributionDTO dto = hrdistributionMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.hrdistributionService.getHrdistributionByEntities(this.hrdistributionMapping.toDomain(#hrdistributiondtos)),'iBizHumanResources-HRDistribution-Update')")
@ApiOperation(value = "批量更新工作人员分配", tags = {"工作人员分配" }, notes = "批量更新工作人员分配")
@RequestMapping(method = RequestMethod.PUT, value = "/hrdistributions/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<HRDistributionDTO> hrdistributiondtos) {
hrdistributionService.updateBatch(hrdistributionMapping.toDomain(hrdistributiondtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.hrdistributionService.get(#hrdistribution_id),'iBizHumanResources-HRDistribution-Remove')")
@ApiOperation(value = "删除工作人员分配", tags = {"工作人员分配" }, notes = "删除工作人员分配")
@RequestMapping(method = RequestMethod.DELETE, value = "/hrdistributions/{hrdistribution_id}")
@Transactional
public ResponseEntity<Boolean> remove(@PathVariable("hrdistribution_id") String hrdistribution_id) {
return ResponseEntity.status(HttpStatus.OK).body(hrdistributionService.remove(hrdistribution_id));
}
@PreAuthorize("hasPermission(this.hrdistributionService.getHrdistributionByIds(#ids),'iBizHumanResources-HRDistribution-Remove')")
@ApiOperation(value = "批量删除工作人员分配", tags = {"工作人员分配" }, notes = "批量删除工作人员分配")
@RequestMapping(method = RequestMethod.DELETE, value = "/hrdistributions/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
hrdistributionService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PostAuthorize("hasPermission(this.hrdistributionMapping.toDomain(returnObject.body),'iBizHumanResources-HRDistribution-Get')")
@ApiOperation(value = "获取工作人员分配", tags = {"工作人员分配" }, notes = "获取工作人员分配")
@RequestMapping(method = RequestMethod.GET, value = "/hrdistributions/{hrdistribution_id}")
public ResponseEntity<HRDistributionDTO> get(@PathVariable("hrdistribution_id") String hrdistribution_id) {
HRDistribution domain = hrdistributionService.get(hrdistribution_id);
HRDistributionDTO dto = hrdistributionMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "获取工作人员分配草稿", tags = {"工作人员分配" }, notes = "获取工作人员分配草稿")
@RequestMapping(method = RequestMethod.GET, value = "/hrdistributions/getdraft")
public ResponseEntity<HRDistributionDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(hrdistributionMapping.toDto(hrdistributionService.getDraft(new HRDistribution())));
}
@ApiOperation(value = "检查工作人员分配", tags = {"工作人员分配" }, notes = "检查工作人员分配")
@RequestMapping(method = RequestMethod.POST, value = "/hrdistributions/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody HRDistributionDTO hrdistributiondto) {
return ResponseEntity.status(HttpStatus.OK).body(hrdistributionService.checkKey(hrdistributionMapping.toDomain(hrdistributiondto)));
}
@PreAuthorize("hasPermission(this.hrdistributionMapping.toDomain(#hrdistributiondto),'iBizHumanResources-HRDistribution-Save')")
@ApiOperation(value = "保存工作人员分配", tags = {"工作人员分配" }, notes = "保存工作人员分配")
@RequestMapping(method = RequestMethod.POST, value = "/hrdistributions/save")
public ResponseEntity<Boolean> save(@RequestBody HRDistributionDTO hrdistributiondto) {
return ResponseEntity.status(HttpStatus.OK).body(hrdistributionService.save(hrdistributionMapping.toDomain(hrdistributiondto)));
}
@PreAuthorize("hasPermission(this.hrdistributionMapping.toDomain(#hrdistributiondtos),'iBizHumanResources-HRDistribution-Save')")
@ApiOperation(value = "批量保存工作人员分配", tags = {"工作人员分配" }, notes = "批量保存工作人员分配")
@RequestMapping(method = RequestMethod.POST, value = "/hrdistributions/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<HRDistributionDTO> hrdistributiondtos) {
hrdistributionService.saveBatch(hrdistributionMapping.toDomain(hrdistributiondtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizHumanResources-HRDistribution-searchDefault-all') and hasPermission(#context,'iBizHumanResources-HRDistribution-Get')")
@ApiOperation(value = "获取DEFAULT", tags = {"工作人员分配" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/hrdistributions/fetchdefault")
public ResponseEntity<List<HRDistributionDTO>> fetchDefault(HRDistributionSearchContext context) {
Page<HRDistribution> domains = hrdistributionService.searchDefault(context) ;
List<HRDistributionDTO> list = hrdistributionMapping.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-HRDistribution-searchDefault-all') and hasPermission(#context,'iBizHumanResources-HRDistribution-Get')")
@ApiOperation(value = "查询DEFAULT", tags = {"工作人员分配" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/hrdistributions/searchdefault")
public ResponseEntity<Page<HRDistributionDTO>> searchDefault(@RequestBody HRDistributionSearchContext context) {
Page<HRDistribution> domains = hrdistributionService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(hrdistributionMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
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.HRPostRel;
import cn.ibizlab.humanresource.core.humanresource.service.IHRPostRelService;
import cn.ibizlab.humanresource.core.humanresource.filter.HRPostRelSearchContext;
import cn.ibizlab.humanresource.util.annotation.VersionCheck;
@Slf4j
@Api(tags = {"职位关系" })
@RestController("HRApi-hrpostrel")
@RequestMapping("")
public class HRPostRelResource {
@Autowired
public IHRPostRelService hrpostrelService;
@Autowired
@Lazy
public HRPostRelMapping hrpostrelMapping;
@PreAuthorize("hasPermission(this.hrpostrelMapping.toDomain(#hrpostreldto),'iBizHumanResources-HRPostRel-Create')")
@ApiOperation(value = "新建职位关系", tags = {"职位关系" }, notes = "新建职位关系")
@RequestMapping(method = RequestMethod.POST, value = "/hrpostrels")
@Transactional
public ResponseEntity<HRPostRelDTO> create(@RequestBody HRPostRelDTO hrpostreldto) {
HRPostRel domain = hrpostrelMapping.toDomain(hrpostreldto);
hrpostrelService.create(domain);
HRPostRelDTO dto = hrpostrelMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.hrpostrelMapping.toDomain(#hrpostreldtos),'iBizHumanResources-HRPostRel-Create')")
@ApiOperation(value = "批量新建职位关系", tags = {"职位关系" }, notes = "批量新建职位关系")
@RequestMapping(method = RequestMethod.POST, value = "/hrpostrels/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<HRPostRelDTO> hrpostreldtos) {
hrpostrelService.createBatch(hrpostrelMapping.toDomain(hrpostreldtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@VersionCheck(entity = "hrpostrel" , versionfield = "updatedate")
@PreAuthorize("hasPermission(this.hrpostrelService.get(#hrpostrel_id),'iBizHumanResources-HRPostRel-Update')")
@ApiOperation(value = "更新职位关系", tags = {"职位关系" }, notes = "更新职位关系")
@RequestMapping(method = RequestMethod.PUT, value = "/hrpostrels/{hrpostrel_id}")
@Transactional
public ResponseEntity<HRPostRelDTO> update(@PathVariable("hrpostrel_id") String hrpostrel_id, @RequestBody HRPostRelDTO hrpostreldto) {
HRPostRel domain = hrpostrelMapping.toDomain(hrpostreldto);
domain .setHrpostrelid(hrpostrel_id);
hrpostrelService.update(domain );
HRPostRelDTO dto = hrpostrelMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.hrpostrelService.getHrpostrelByEntities(this.hrpostrelMapping.toDomain(#hrpostreldtos)),'iBizHumanResources-HRPostRel-Update')")
@ApiOperation(value = "批量更新职位关系", tags = {"职位关系" }, notes = "批量更新职位关系")
@RequestMapping(method = RequestMethod.PUT, value = "/hrpostrels/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<HRPostRelDTO> hrpostreldtos) {
hrpostrelService.updateBatch(hrpostrelMapping.toDomain(hrpostreldtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.hrpostrelService.get(#hrpostrel_id),'iBizHumanResources-HRPostRel-Remove')")
@ApiOperation(value = "删除职位关系", tags = {"职位关系" }, notes = "删除职位关系")
@RequestMapping(method = RequestMethod.DELETE, value = "/hrpostrels/{hrpostrel_id}")
@Transactional
public ResponseEntity<Boolean> remove(@PathVariable("hrpostrel_id") String hrpostrel_id) {
return ResponseEntity.status(HttpStatus.OK).body(hrpostrelService.remove(hrpostrel_id));
}
@PreAuthorize("hasPermission(this.hrpostrelService.getHrpostrelByIds(#ids),'iBizHumanResources-HRPostRel-Remove')")
@ApiOperation(value = "批量删除职位关系", tags = {"职位关系" }, notes = "批量删除职位关系")
@RequestMapping(method = RequestMethod.DELETE, value = "/hrpostrels/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
hrpostrelService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PostAuthorize("hasPermission(this.hrpostrelMapping.toDomain(returnObject.body),'iBizHumanResources-HRPostRel-Get')")
@ApiOperation(value = "获取职位关系", tags = {"职位关系" }, notes = "获取职位关系")
@RequestMapping(method = RequestMethod.GET, value = "/hrpostrels/{hrpostrel_id}")
public ResponseEntity<HRPostRelDTO> get(@PathVariable("hrpostrel_id") String hrpostrel_id) {
HRPostRel domain = hrpostrelService.get(hrpostrel_id);
HRPostRelDTO dto = hrpostrelMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "获取职位关系草稿", tags = {"职位关系" }, notes = "获取职位关系草稿")
@RequestMapping(method = RequestMethod.GET, value = "/hrpostrels/getdraft")
public ResponseEntity<HRPostRelDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(hrpostrelMapping.toDto(hrpostrelService.getDraft(new HRPostRel())));
}
@ApiOperation(value = "检查职位关系", tags = {"职位关系" }, notes = "检查职位关系")
@RequestMapping(method = RequestMethod.POST, value = "/hrpostrels/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody HRPostRelDTO hrpostreldto) {
return ResponseEntity.status(HttpStatus.OK).body(hrpostrelService.checkKey(hrpostrelMapping.toDomain(hrpostreldto)));
}
@PreAuthorize("hasPermission(this.hrpostrelMapping.toDomain(#hrpostreldto),'iBizHumanResources-HRPostRel-Save')")
@ApiOperation(value = "保存职位关系", tags = {"职位关系" }, notes = "保存职位关系")
@RequestMapping(method = RequestMethod.POST, value = "/hrpostrels/save")
public ResponseEntity<Boolean> save(@RequestBody HRPostRelDTO hrpostreldto) {
return ResponseEntity.status(HttpStatus.OK).body(hrpostrelService.save(hrpostrelMapping.toDomain(hrpostreldto)));
}
@PreAuthorize("hasPermission(this.hrpostrelMapping.toDomain(#hrpostreldtos),'iBizHumanResources-HRPostRel-Save')")
@ApiOperation(value = "批量保存职位关系", tags = {"职位关系" }, notes = "批量保存职位关系")
@RequestMapping(method = RequestMethod.POST, value = "/hrpostrels/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<HRPostRelDTO> hrpostreldtos) {
hrpostrelService.saveBatch(hrpostrelMapping.toDomain(hrpostreldtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizHumanResources-HRPostRel-searchDefault-all') and hasPermission(#context,'iBizHumanResources-HRPostRel-Get')")
@ApiOperation(value = "获取DEFAULT", tags = {"职位关系" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/hrpostrels/fetchdefault")
public ResponseEntity<List<HRPostRelDTO>> fetchDefault(HRPostRelSearchContext context) {
Page<HRPostRel> domains = hrpostrelService.searchDefault(context) ;
List<HRPostRelDTO> list = hrpostrelMapping.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-HRPostRel-searchDefault-all') and hasPermission(#context,'iBizHumanResources-HRPostRel-Get')")
@ApiOperation(value = "查询DEFAULT", tags = {"职位关系" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/hrpostrels/searchdefault")
public ResponseEntity<Page<HRPostRelDTO>> searchDefault(@RequestBody HRPostRelSearchContext context) {
Page<HRPostRel> domains = hrpostrelService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(hrpostrelMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册