同步bug修改

master
anthonywj 2 years ago
parent 84860f6672
commit 6d52ad21cf

@ -91,9 +91,10 @@ public class ThrDeptController {
return ResultVOUtils.success("添加成功!");
}
@PostMapping("/spms/thrsys/warehouse/edit")
public BaseResponse edit(@RequestBody @Valid ThrDeptEntity thrDeptEntity,
BindingResult bindingResult,FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest,FilterThrDeptRequest filterThrDeptRequest) {
BindingResult bindingResult, FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest, FilterThrDeptRequest filterThrDeptRequest) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
@ -111,13 +112,12 @@ public class ThrDeptController {
//修改仓库
thrInvWarehouseService.updateThrInvWarehouse(thrInvWarehouseEntity);
}
//判断部门是否存在
//判断部门是否存在
filterThrDeptRequest.setCode(thrDeptEntity.getCode());
filterThrDeptRequest.setName(thrDeptEntity.getName());
filterThrDeptRequest.setThirdSysFk(thrDeptEntity.getThirdSysFk());
filterThrDeptRequest.setStatus(thrDeptEntity.getStatus());
List<ThrDeptEntity> thrDeptEntities = thrDeptService.filterThrInvWarehouse(filterThrDeptRequest);
if(thrDeptEntities.size()==0 ){
if (!thrDeptService.editExit(thrDeptEntity.getCode(), thrDeptEntity.getCode(), thrDeptEntity.getId())) {
thrDeptEntity.setPid(null); // 不能修改父级 pid
thrDeptEntity.setUpdateTime(new Date());
boolean b = thrDeptService.updateInvWarehouse(thrDeptEntity);
@ -125,7 +125,7 @@ public class ThrDeptController {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}
return ResultVOUtils.success();
}else{
} else {
return ResultVOUtils.error(ResultEnum.DATA_REPEAT);
}
@ -162,7 +162,7 @@ public class ThrDeptController {
// }
// filterThrSubInvWarehouseRequest.setParentId((String) thirdId);
filterThrSubInvWarehouseRequest.setStatus(0);
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.selectByThrDeptCode(filterThrSubInvWarehouseRequest);
List<ThrInvWarehouseEntity> thrInvWarehouseEntities = thrInvWarehouseService.selectByThrDeptCode(filterThrSubInvWarehouseRequest);
PageInfo<ThrInvWarehouseEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvWarehouseEntities);
PageSimpleResponse<ThrInvWarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();

@ -12,13 +12,11 @@ import java.util.List;
@Mapper
public interface InvSpaceDao extends BaseMapperPlus<InvSpaceDao, InvSpace, InvSpace> {
int deleteByPrimaryKey(Integer id);
int insertEntity(InvSpace record);
int insertSelective(InvSpace record);
InvSpace selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(InvSpace record);
@ -103,4 +101,4 @@ public interface InvSpaceDao extends BaseMapperPlus<InvSpaceDao, InvSpace, InvSp
* @return
*/
String getMaxSpaceCode(@Param("invCode") String invCode);
}
}

@ -1,5 +1,7 @@
package com.glxp.api.entity.auth;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@ -8,6 +10,7 @@ import java.util.Date;
*
*/
@Data
@TableName(value = "auth_space")
public class InvSpace {
private Long id;

@ -1,6 +1,7 @@
package com.glxp.api.service.auth.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.common.enums.ResultEnum;
@ -68,7 +69,8 @@ public class InvSpaceServiceImpl implements InvSpaceService {
invSpace.setUpdateTime(date);
invSpace.setCreateUser(user.getUserName());
invSpace.setUpdateUser(user.getUserName());
invSpaceDao.insertEntity(invSpace);
invSpace.setId(IdUtil.getSnowflakeNextId());
invSpaceDao.insert(invSpace);
return ResultVOUtils.success();
}
@ -92,8 +94,8 @@ public class InvSpaceServiceImpl implements InvSpaceService {
@Override
public BaseResponse deleteSpace(String id) {
//校验此货位是否已经被使用,如果已经被使用,不能删除
Integer spaceId = Integer.valueOf(id);
InvSpace invSpace = invSpaceDao.selectByPrimaryKey(spaceId);
Long spaceId = Long.valueOf(id);
InvSpace invSpace = invSpaceDao.selectById(spaceId);
//todo 代码迁移,后面记得修改
@ -108,7 +110,7 @@ public class InvSpaceServiceImpl implements InvSpaceService {
// if (count > 0) {
// return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "此货位已被使用,无法删除!");
// }
invSpaceDao.deleteByPrimaryKey(spaceId);
invSpaceDao.deleteById(spaceId);
return ResultVOUtils.success();
}

@ -115,7 +115,7 @@ public class InvWarehouseServiceImpl implements InvWarehouseService {
@Override
public boolean insertInvSubWarehouse(InvWarehouseEntity invWarehouseEntity) {
return invWarehouseDao.insertInvSubWarehouse(invWarehouseEntity);
return invWarehouseDao.insert(invWarehouseEntity) > 0;
}
@Override

@ -11,6 +11,9 @@ public interface ThrDeptService {
ThrDeptEntity findDefault(Boolean advaceType, Boolean isDefault);
boolean editExit(String code, String thirdSysFk, Long id);
List<ThrDeptEntity> filterThrInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);
List<ThrDeptEntity> filterGroupInvWarehouse(FilterThrDeptRequest filterThrDeptRequest);

@ -2,6 +2,7 @@ package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
@ -47,6 +48,11 @@ public class ThrDeptServiceImpl implements ThrDeptService {
return null;
}
@Override
public boolean editExit(String code, String thirdSysFk, Long id) {
return thrDeptDao.exists(new QueryWrapper<ThrDeptEntity>().eq("code", code).eq("thirdSysFk", thirdSysFk).ne("id", id));
}
@Override
public List<ThrDeptEntity> filterThrInvWarehouse(FilterThrDeptRequest filterThrDeptRequest) {
if (filterThrDeptRequest == null) {

@ -1,6 +1,6 @@
spring:
profiles:
active: test
active: dev
jmx:
enabled: false
servlet:

@ -79,7 +79,8 @@
<delete id="deleteByUser" parameterType="java.lang.Long">
delete
from auth_dept_user
where userId = #{userId} and deptId != 1
where userId = #{userId}
and deptId != 1
</delete>
<delete id="deleteByDept" parameterType="java.lang.Long">
delete

@ -31,18 +31,6 @@
remark
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from auth_space
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from auth_space
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insertEntity" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.auth.InvSpace"
useGeneratedKeys="true">
@ -408,4 +396,4 @@
</if>
</where>
</select>
</mapper>
</mapper>

@ -134,7 +134,7 @@
parameterType="com.glxp.api.entity.auth.InvWarehouseEntity">
replace
INTO auth_warehouse
( id, code, `name`, parentId, remark, defaultInv, advanceType, spUse,parentCode
( id, code, `name`, parentId, remark, defaultInv, advanceType, spUse, parentCode
, thirdId, thirdId1, thirdId2, thirdId3, thirdId4)
values (#{id},
#{code},
@ -159,13 +159,13 @@
WHERE id = #{id}
</delete>
<select id="getByWareId" resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
select *
<select id="getByWareId" resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
select *
FROM auth_warehouse
WHERE id = #{id}
</select>
<select id="getByWarePcode" resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
<select id="getByWarePcode" resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
select *
FROM auth_warehouse
WHERE parentCode = #{parentCode}
@ -217,6 +217,9 @@
<if test="advanceType != null">
advanceType=#{advanceType},
</if>
<if test="updateTime != null">
updateTime=#{updateTime},
</if>
<if test="spUse != null">
spUse=#{spUse},
</if>
@ -311,8 +314,8 @@
AND a.advanceType = #{advanceType}
</if>
<if test="key != null and key != ''">
AND (a.name like concat('%', #{key}, '%') or
a.code = #{key})
AND (a.name like concat('%', #{key}, '%') or
a.code = #{key})
</if>
</where>
</select>
@ -371,7 +374,7 @@
auth_dept.name warehouseName
from auth_warehouse
inner join auth_dept on auth_warehouse.parentId = auth_dept.code
LEFT join auth_warehouse_user on auth_warehouse.code = auth_warehouse_user.code
LEFT join auth_warehouse_user on auth_warehouse.code = auth_warehouse_user.code
<where>
<if test="userId != null">
AND auth_warehouse_user.userId = #{userId}
@ -435,12 +438,18 @@
</select>
<select id="selectLowWarehouseAll" parameterType="java.lang.String" resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
<select id="selectLowWarehouseAll" parameterType="java.lang.String"
resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
with recursive table_a as (
select * from auth_warehouse ta where parentCode = #{pcode}
union all
select tb.* from auth_warehouse tb inner join table_a on table_a.code = tb.parentCode
)
select * from table_a
select *
from auth_warehouse ta
where parentCode = #{pcode}
union all
select tb.*
from auth_warehouse tb
inner join table_a on table_a.code = tb.parentCode
)
select *
from table_a
</select>
</mapper>

@ -350,3 +350,9 @@ CALL Pro_Temp_ColumnWork('auth_dept_user', 'userId', 'bigint', 2);
CALL Pro_Temp_ColumnWork('auth_dept_user', 'deptId', 'bigint', 2);
CALL Pro_Temp_ColumnWork('basic_bustype_pre', 'Id', 'bigint', 2);
CALL Pro_Temp_ColumnWork('basic_export_status', 'remark', 'varchar(2048)', 2);
CALL Pro_Temp_ColumnWork('auth_role', 'isCustomer', 'int', 1);
ALTER TABLE `auth_dept_user`
ADD UNIQUE (`userId`, deptId);

Loading…
Cancel
Save