Browse Source

append

dev_power_axis
YUJT 3 years ago
parent
commit
18b783d9f0
  1. 3
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisLeaderController.java
  2. 2
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructLeaderDao.java
  3. 27
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java
  4. 4
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructLeaderDao.xml

3
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisLeaderController.java

@ -71,8 +71,9 @@ public class PowerAxisLeaderController {
@NoRepeatSubmit
@PostMapping("update")
public Result update(@RequestBody PowerAxisLeaderDTO dto) {
public Result update(@RequestBody PowerAxisLeaderDTO dto, @LoginUser TokenDto tokenDto) {
//效验数据
dto.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
powerAxisLeaderService.update(dto);
return new Result();

2
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructLeaderDao.java

@ -14,7 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PowerAxisStructLeaderDao extends BaseDao<PowerAxisStructLeaderEntity> {
String queryId(PowerAxisStructLeaderEntity leaderEntity);
PowerAxisSLeaderResultDTO queryLeaderDetailById(String axisStructId);
}

27
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java

@ -24,7 +24,7 @@ import java.util.List;
import java.util.Map;
/**
* 动力主轴领导人
* 动力主轴领导人
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-04-18
@ -51,8 +51,8 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD
return ConvertUtils.sourceToTarget(entityList, PowerAxisLeaderDTO.class);
}
private QueryWrapper<PowerAxisLeaderEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<PowerAxisLeaderEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<PowerAxisLeaderEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -71,7 +71,7 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD
public void save(PowerAxisLeaderDTO dto) {
PowerAxisLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisLeaderEntity.class);
boolean i = insert(entity);
if(i){
if (i) {
PowerAxisStructLeaderEntity leaderEntity = new PowerAxisStructLeaderEntity();
leaderEntity.setCustomerId(dto.getCustomerId());
leaderEntity.setLeaderId(entity.getId());
@ -84,16 +84,15 @@ public class PowerAxisLeaderServiceImpl extends BaseServiceImpl<PowerAxisLeaderD
@Transactional(rollbackFor = Exception.class)
public void update(PowerAxisLeaderDTO dto) {
PowerAxisLeaderEntity entity = ConvertUtils.sourceToTarget(dto, PowerAxisLeaderEntity.class);
boolean i = updateById(entity);
if(i){
PowerAxisStructLeaderEntity leaderEntity = new PowerAxisStructLeaderEntity();
leaderEntity.setLeaderId(entity.getId());
leaderEntity.setStructReferenceId(dto.getStructReferenceId());
leaderEntity.setCustomerId(dto.getCustomerId());
leaderEntity.setId(powerAxisStructLeaderDao.queryId(leaderEntity));
System.out.println(leaderEntity.getId());
powerAxisStructLeaderDao.updateById(leaderEntity);
}
boolean i = updateById(entity);
if (i) {
// todo 关联表,先删除(by structReferenceId),再插入
PowerAxisStructLeaderEntity leaderEntity = new PowerAxisStructLeaderEntity();
leaderEntity.setLeaderId(entity.getId());
leaderEntity.setStructReferenceId(dto.getStructReferenceId());
leaderEntity.setCustomerId(dto.getCustomerId());
powerAxisStructLeaderDao.updateById(leaderEntity);
}
}
@Override

4
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructLeaderDao.xml

@ -16,10 +16,6 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="queryId" resultType="java.lang.String">
select id from pli_power_axis_struct_leader
where customer_id = #{customerId}
</select>
<select id="queryLeaderDetailById"
resultType="com.epmet.plugin.power.dto.axis.result.PowerAxisSLeaderResultDTO">
SELECT

Loading…
Cancel
Save