14 changed files with 469 additions and 12 deletions
@ -0,0 +1,69 @@ |
|||
package com.epmet.plugin.power.dto.axis; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 动力主轴负责人关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-04-19 |
|||
*/ |
|||
@Data |
|||
public class PowerAxisStructLeaderDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 关联动力主轴ID |
|||
*/ |
|||
private String structReferenceId; |
|||
|
|||
/** |
|||
* 负责人ID |
|||
*/ |
|||
private String leaderId; |
|||
|
|||
/** |
|||
* 删除标识 0.未删除 1.已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.epmet.plugin.power.modules.axis.controller; |
|||
|
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ExcelUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO; |
|||
import com.epmet.plugin.power.modules.axis.excel.PowerAxisStructLeaderExcel; |
|||
import com.epmet.plugin.power.modules.axis.service.PowerAxisStructLeaderService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 动力主轴负责人关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-04-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("powerAxisStructLeader") |
|||
public class PowerAxisStructLeaderController { |
|||
|
|||
@Autowired |
|||
private PowerAxisStructLeaderService powerAxisStructLeaderService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<PowerAxisStructLeaderDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<PowerAxisStructLeaderDTO> page = powerAxisStructLeaderService.page(params); |
|||
return new Result<PageData<PowerAxisStructLeaderDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
|||
public Result<PowerAxisStructLeaderDTO> get(@PathVariable("id") String id){ |
|||
PowerAxisStructLeaderDTO data = powerAxisStructLeaderService.get(id); |
|||
return new Result<PowerAxisStructLeaderDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@RequestBody PowerAxisStructLeaderDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
powerAxisStructLeaderService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@RequestBody PowerAxisStructLeaderDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
powerAxisStructLeaderService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
powerAxisStructLeaderService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<PowerAxisStructLeaderDTO> list = powerAxisStructLeaderService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, PowerAxisStructLeaderExcel.class); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.plugin.power.modules.axis.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 动力主轴负责人关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-04-19 |
|||
*/ |
|||
@Mapper |
|||
public interface PowerAxisStructLeaderDao extends BaseDao<PowerAxisStructLeaderEntity> { |
|||
|
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.epmet.plugin.power.modules.axis.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 动力主轴负责人关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-04-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("pli_power_axis_struct_leader") |
|||
public class PowerAxisStructLeaderEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 关联动力主轴ID |
|||
*/ |
|||
private String structReferenceId; |
|||
|
|||
/** |
|||
* 负责人ID |
|||
*/ |
|||
private String leaderId; |
|||
|
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.epmet.plugin.power.modules.axis.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 动力主轴负责人关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-04-19 |
|||
*/ |
|||
@Data |
|||
public class PowerAxisStructLeaderExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "客户ID") |
|||
private String customerId; |
|||
|
|||
@Excel(name = "关联动力主轴ID") |
|||
private String structReferenceId; |
|||
|
|||
@Excel(name = "负责人ID") |
|||
private String leaderId; |
|||
|
|||
@Excel(name = "删除标识 0.未删除 1.已删除") |
|||
private String delFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.plugin.power.modules.axis.redis; |
|||
|
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 动力主轴负责人关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-04-19 |
|||
*/ |
|||
@Component |
|||
public class PowerAxisStructLeaderRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,78 @@ |
|||
package com.epmet.plugin.power.modules.axis.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO; |
|||
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 动力主轴负责人关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-04-19 |
|||
*/ |
|||
public interface PowerAxisStructLeaderService extends BaseService<PowerAxisStructLeaderEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<PowerAxisStructLeaderDTO> |
|||
* @author generator |
|||
* @date 2022-04-19 |
|||
*/ |
|||
PageData<PowerAxisStructLeaderDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<PowerAxisStructLeaderDTO> |
|||
* @author generator |
|||
* @date 2022-04-19 |
|||
*/ |
|||
List<PowerAxisStructLeaderDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return PowerAxisStructLeaderDTO |
|||
* @author generator |
|||
* @date 2022-04-19 |
|||
*/ |
|||
PowerAxisStructLeaderDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-04-19 |
|||
*/ |
|||
void save(PowerAxisStructLeaderDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-04-19 |
|||
*/ |
|||
void update(PowerAxisStructLeaderDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-04-19 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,85 @@ |
|||
package com.epmet.plugin.power.modules.axis.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructLeaderDao; |
|||
import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO; |
|||
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity; |
|||
import com.epmet.plugin.power.modules.axis.service.PowerAxisStructLeaderService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 动力主轴负责人关系 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-04-19 |
|||
*/ |
|||
@Service |
|||
public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl<PowerAxisStructLeaderDao, PowerAxisStructLeaderEntity> implements PowerAxisStructLeaderService { |
|||
|
|||
// @Autowired
|
|||
// private PowerAxisStructLeaderRedis powerAxisStructLeaderRedis;
|
|||
|
|||
@Override |
|||
public PageData<PowerAxisStructLeaderDTO> page(Map<String, Object> params) { |
|||
IPage<PowerAxisStructLeaderEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, PowerAxisStructLeaderDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<PowerAxisStructLeaderDTO> list(Map<String, Object> params) { |
|||
List<PowerAxisStructLeaderEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, PowerAxisStructLeaderDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<PowerAxisStructLeaderEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<PowerAxisStructLeaderEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public PowerAxisStructLeaderDTO get(String id) { |
|||
PowerAxisStructLeaderEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, PowerAxisStructLeaderDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(PowerAxisStructLeaderDTO dto) { |
|||
PowerAxisStructLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisStructLeaderEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(PowerAxisStructLeaderDTO dto) { |
|||
PowerAxisStructLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisStructLeaderEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
<?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.epmet.plugin.power.modules.axis.dao.PowerAxisStructLeaderDao"> |
|||
|
|||
<resultMap type="com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity" id="powerAxisStructLeaderMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="structReferenceId" column="STRUCT_REFERENCE_ID"/> |
|||
<result property="leaderId" column="LEADER_ID"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue