Merge remote-tracking branch 'origin/dev_price' into dev_price

test
wj 1 year ago
commit fc4cbf3cf3

@ -131,7 +131,7 @@ public class BasicProductCategoryController {
}
@GetMapping("/udiwms/basic/product/category/delect")
@Log(title = "单据管理", businessType = BusinessType.DELETE)
@Log(title = "物资分类删除", businessType = BusinessType.DELETE)
public BaseResponse delect(BasicProductTypeRequest basicProductTypeRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
@ -157,8 +157,8 @@ public class BasicProductCategoryController {
}
@GetMapping("/udiwms/basic/product/category/getTree")
public BaseResponse getTree() {
List<BasicProductCategoryTypeResponse> treeList = basicProductCategoryService.getTreeList();
public BaseResponse getTree(BasicProductTypeRequest basicProductTypeRequest) {
List<BasicProductCategoryTypeResponse> treeList = basicProductCategoryService.getTreeList(basicProductTypeRequest);
return ResultVOUtils.success(treeList);
}

@ -2,6 +2,7 @@ package com.glxp.api.dao.basic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.basic.BasicProductCategory;
import com.glxp.api.req.basic.BasicProductTypeRequest;
import com.glxp.api.res.basic.BasicProductCategoryTypeResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -10,7 +11,9 @@ import java.util.List;
@Mapper
public interface BasicProductCategoryMapper extends BaseMapper<BasicProductCategory> {
List<BasicProductCategoryTypeResponse> getTreeList();
List<BasicProductCategoryTypeResponse> getTreeList(BasicProductTypeRequest basicProductTypeRequest);
List<BasicProductCategory> selectLowTypeAll(@Param("code") String code);
Long selectProductByRelCode(@Param("relCode") String relCode);

@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;
/**
@ -63,4 +65,16 @@ public class BasicProductCategory {
*/
@TableField(value = "updateUser")
private String updateUser;
}
/**
*
*/
@TableField(value = "deptCode")
private String deptCode;
/**
*
*/
@TableField(value = "invCode")
private String invCode;
}

@ -7,10 +7,13 @@ import java.util.List;
@Data
public class BasicProductTypeRequest {
private Long id;
private String code;
private String parentCode;
private String name;
private String remark;
List<String> ids;
private Long id;
private String code;
private String parentCode;
private String name;
private String remark;
private String deptCode;
private String invCode;
List<String> ids;
}

@ -36,28 +36,26 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ
BasicProductCategoryRelMapper basicProductCategoryRelMapper;
@Override
public List<BasicProductCategoryTypeResponse> getTreeList() {
return basicProductCategoryMapper.getTreeList();
public List<BasicProductCategoryTypeResponse> getTreeList(BasicProductTypeRequest basicProductTypeRequest) {
return basicProductCategoryMapper.getTreeList(basicProductTypeRequest);
}
@Override
public BasicProductCategory selectBasicHospTypeEntity() {
QueryWrapper<BasicProductCategory> Wrapper = new QueryWrapper<>();
Wrapper.eq("code",10000).last("limit 1");
Wrapper.eq("code", 10000).last("limit 1");
return basicProductCategoryMapper.selectOne(Wrapper);
}
@Override
public List<BasicProductCategory> getMenuList(BasicProductTypeFilterRequest basicProductTypeFilterRequest) {
QueryWrapper<BasicProductCategory> ew=new QueryWrapper<>();
ew.ne("code",10000);
if(basicProductTypeFilterRequest.getType()!=null && basicProductTypeFilterRequest.getType()==1 && StrUtil.isNotEmpty(basicProductTypeFilterRequest.getCode())){
QueryWrapper<BasicProductCategory> ew = new QueryWrapper<>();
ew.ne("code", 10000);
if (basicProductTypeFilterRequest.getType() != null && basicProductTypeFilterRequest.getType() == 1 && StrUtil.isNotEmpty(basicProductTypeFilterRequest.getCode())) {
List<BasicProductCategory> basicProductCategories = basicProductCategoryMapper.selectLowTypeAll(basicProductTypeFilterRequest.getCode());
List<Long> ids = basicProductCategories.stream().map(BasicProductCategory::getId).collect(Collectors.toList());
ew.notIn("id",ids);
ew.notIn("id", ids);
}
List<BasicProductCategory> list = basicProductCategoryMapper.selectList(ew);
return list;
@ -65,29 +63,29 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ
@Override
public Boolean checkName(BasicProductTypeRequest basicProductTypeRequest, Integer type) {
Long sum=null;
Long sum = null;
//1添加
if(type==1){
if (type == 1) {
//查看名字是不是重复
QueryWrapper<BasicProductCategory> ew=new QueryWrapper<>();
ew.eq("name",basicProductTypeRequest.getName());
sum=basicProductCategoryMapper.selectCount(ew);
}else{
QueryWrapper<BasicProductCategory> ew=new QueryWrapper<>();
ew.eq("name",basicProductTypeRequest.getName());
ew.ne("id",basicProductTypeRequest.getId());
sum=basicProductCategoryMapper.selectCount(ew);
QueryWrapper<BasicProductCategory> ew = new QueryWrapper<>();
ew.eq("name", basicProductTypeRequest.getName());
sum = basicProductCategoryMapper.selectCount(ew);
} else {
QueryWrapper<BasicProductCategory> ew = new QueryWrapper<>();
ew.eq("name", basicProductTypeRequest.getName());
ew.ne("id", basicProductTypeRequest.getId());
sum = basicProductCategoryMapper.selectCount(ew);
}
if(sum>0){
if (sum > 0) {
return false;
}else{
} else {
return true;
}
}
@Override
public boolean updateBasicHospType(BasicProductTypeRequest basicProductTypeRequest) {
boolean falg=true;
boolean falg = true;
BasicProductCategory basicProductCategory = new BasicProductCategory();
basicProductCategory.setId(basicProductTypeRequest.getId());
basicProductCategory.setCreateTime(new Date());
@ -95,19 +93,19 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ
basicProductCategory.setName(basicProductTypeRequest.getName());
basicProductCategory.setParentCode(basicProductTypeRequest.getParentCode());
basicProductCategory.setRemark(basicProductTypeRequest.getRemark());
Long userId=customerService.getUserId();
basicProductCategory.setCreateUser(userId+"");
basicProductCategory.setUpdateUser(userId+"");
Long userId = customerService.getUserId();
basicProductCategory.setCreateUser(userId + "");
basicProductCategory.setUpdateUser(userId + "");
int i = basicProductCategoryMapper.updateById(basicProductCategory);
if(i == 0){
falg=false;
if (i == 0) {
falg = false;
}
return falg;
}
@Override
public Boolean saveBasicHospType(BasicProductTypeRequest basicProductTypeRequest) {
boolean falg=true;
boolean falg = true;
BasicProductCategory basicProductCategory = new BasicProductCategory();
basicProductCategory.setId(basicProductTypeRequest.getId());
basicProductCategory.setCreateTime(new Date());
@ -115,34 +113,34 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ
basicProductCategory.setName(basicProductTypeRequest.getName());
basicProductCategory.setParentCode(basicProductTypeRequest.getParentCode());
basicProductCategory.setRemark(basicProductTypeRequest.getRemark());
Long userId=customerService.getUserId();
basicProductCategory.setCreateUser(userId+"");
basicProductCategory.setUpdateUser(userId+"");
Long userId = customerService.getUserId();
basicProductCategory.setCreateUser(userId + "");
basicProductCategory.setUpdateUser(userId + "");
//获取数据库最大的code
QueryWrapper<BasicProductCategory> ew=new QueryWrapper<>();
QueryWrapper<BasicProductCategory> ew = new QueryWrapper<>();
ew.select("max(code) as code");
BasicProductCategory basicProductCategory1 = basicProductCategoryMapper.selectOne(ew);
basicProductCategory.setCode(Integer.valueOf(basicProductCategory1.getCode())+1+"");
basicProductCategory.setCode(Integer.valueOf(basicProductCategory1.getCode()) + 1 + "");
basicProductCategory.setId(IdUtil.getSnowflakeNextId());
int insert = basicProductCategoryMapper.insert(basicProductCategory);
if(insert == 0){
falg=false;
if (insert == 0) {
falg = false;
}
return falg;
}
@Override
public String delectBasicHospType(BasicProductTypeRequest basicProductTypeRequest) {
//查询是否有自己的子集
QueryWrapper<BasicProductCategory> ew=new QueryWrapper<>();
ew.eq("parentCode",basicProductTypeRequest.getCode());
Long count=basicProductCategoryMapper.selectCount(ew);
if(count>0){
//查询是否有自己的子集
QueryWrapper<BasicProductCategory> ew = new QueryWrapper<>();
ew.eq("parentCode", basicProductTypeRequest.getCode());
Long count = basicProductCategoryMapper.selectCount(ew);
if (count > 0) {
return "请先删除该节点底下的数据!";
}
//查询是否有绑定产品
count = basicProductCategoryMapper.selectProductByRelCode(basicProductTypeRequest.getCode());
if(count >0){
count = basicProductCategoryMapper.selectProductByRelCode(basicProductTypeRequest.getCode());
if (count > 0) {
return "该节点还存在产品,请先删除!";
}
basicProductCategoryMapper.deleteById(basicProductTypeRequest.getId());
@ -166,34 +164,34 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ
@Override
public boolean insertCateRel(BasicProductTypeRequest basicProductTypeRequest) {
BasicProductCategoryRel basicProductCategoryRel = new BasicProductCategoryRel();
int insert =0;
int insert = 0;
for (String id : basicProductTypeRequest.getIds()) {
basicProductCategoryRel.setRelId(id);
basicProductCategoryRel.setCode(basicProductTypeRequest.getCode());
insert = basicProductCategoryRelMapper.insert(basicProductCategoryRel);
insert = basicProductCategoryRelMapper.insert(basicProductCategoryRel);
}
return insert>0;
return insert > 0;
}
@Override
public BasicProductCategory checkCode(String parentCode) {
return basicProductCategoryMapper.selectOne(new QueryWrapper<BasicProductCategory>().eq("code",parentCode).last("limit 1"));
return basicProductCategoryMapper.selectOne(new QueryWrapper<BasicProductCategory>().eq("code", parentCode).last("limit 1"));
}
@Override
public boolean deleterelByid(Integer id) {
return basicProductCategoryRelMapper.deleteById(id)>0;
return basicProductCategoryRelMapper.deleteById(id) > 0;
}
@Override
public boolean checkExist(String code) {
List<BasicProductCategory> list = basicProductCategoryMapper.selectList(new QueryWrapper<BasicProductCategory>().eq("parentCode", code));
if(list != null && list.size()>0){
return true;
}
if (list != null && list.size() > 0) {
return true;
}
return false;
}
@ -202,9 +200,9 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ
public boolean checkrel(String code) {
List<BasicProductCategoryRel> relList = basicProductCategoryRelMapper.selectList(new QueryWrapper<BasicProductCategoryRel>().eq("code", code));
if(relList != null && relList.size() > 0){
return true;
}
if (relList != null && relList.size() > 0) {
return true;
}
return false;
}

@ -11,7 +11,7 @@ import java.util.List;
public interface BasicProductCategoryService {
List<BasicProductCategoryTypeResponse> getTreeList();
List<BasicProductCategoryTypeResponse> getTreeList(BasicProductTypeRequest basicProductTypeRequest);
BasicProductCategory selectBasicHospTypeEntity();
@ -39,6 +39,5 @@ public interface BasicProductCategoryService {
boolean checkrel(String code);
}

@ -1,54 +1,56 @@
<?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.glxp.api.dao.basic.BasicProductCategoryMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.BasicProductCategory">
<!--@mbg.generated-->
<!--@Table basic_product_category-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="parentCode" jdbcType="VARCHAR" property="parentCode" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
<result column="createUser" jdbcType="VARCHAR" property="createUser" />
<result column="updateUser" jdbcType="VARCHAR" property="updateUser" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, code, parentCode, `name`, remark, createTime, updateTime, `createUser`, updateUser
</sql>
<resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.BasicProductCategory">
<!--@mbg.generated-->
<!--@Table basic_product_category-->
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="parentCode" jdbcType="VARCHAR" property="parentCode"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="createUser" jdbcType="VARCHAR" property="createUser"/>
<result column="updateUser" jdbcType="VARCHAR" property="updateUser"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, code, parentCode, `name`, remark, createTime, updateTime, `createUser`, updateUser
</sql>
<select id="getTreeList" resultType="com.glxp.api.res.basic.BasicProductCategoryTypeResponse">
SELECT id, code, name as label, parentCode,remark
FROM basic_product_category
ORDER BY id DESC
</select>
<select id="getTreeList" resultType="com.glxp.api.res.basic.BasicProductCategoryTypeResponse">
SELECT id, code, name as label, parentCode, remark
FROM basic_product_category
<where>
<if test="deptCode != '' and deptCode != null">
and deptCode = #{deptCode}
</if>
<if test="invCode != '' and invCode != null">
and invCode = #{invCode}
</if>
</where>
ORDER BY id DESC
</select>
<select id="selectLowTypeAll" parameterType="java.lang.String" resultType="com.glxp.api.entity.basic.BasicProductCategory">
WITH recursive table_a AS (
SELECT
*
FROM
basic_product_category ta
WHERE
code = #{code}
UNION ALL
SELECT
tb.*
FROM
basic_product_category tb
INNER JOIN table_a ON table_a.CODE = tb.parentCode
) SELECT
*
FROM
table_a
</select>
<select id="selectProductByRelCode" resultType="Long">
select count(*)
from basic_udirel
where basic_udirel.relCode = #{relCode}
</select>
<select id="selectLowTypeAll" parameterType="java.lang.String"
resultType="com.glxp.api.entity.basic.BasicProductCategory">
WITH recursive table_a AS (
SELECT *
FROM basic_product_category ta
WHERE code = #{code}
UNION ALL
SELECT tb.*
FROM basic_product_category tb
INNER JOIN table_a ON table_a.CODE = tb.parentCode
)
SELECT *
FROM table_a
</select>
<select id="selectProductByRelCode" resultType="Long">
select count(*)
from basic_udirel
where basic_udirel.relCode = #{relCode}
</select>
</mapper>

@ -73,4 +73,12 @@ CREATE TABLE IF NOT EXISTS `sys_app_version`
COLLATE = utf8mb4_0900_ai_ci
ROW_FORMAT = DYNAMIC;
INSERT ignore INTO `sys_app_version`(`id`, `type`, `versionName`, `versionCode`, `appName`, `createTime`, `downloadUrl`, `updateLog`) VALUES (1, 'udi_wms_new', '3.0.6', 306, 'UDI扫码终端', '2023-10-30 18:42:24', 'http://192.168.1.11:9150/udiwms_new.apk', '1.单据审核移除UDI码异常提示2优化多项功能');
INSERT ignore INTO `sys_app_version`(`id`, `type`, `versionName`, `versionCode`, `appName`, `createTime`, `downloadUrl`,
`updateLog`)
VALUES (1, 'udi_wms_new', '3.0.6', 306, 'UDI扫码终端', '2023-10-30 18:42:24', 'http://192.168.1.11:9150/udiwms_new.apk',
'1.单据审核移除UDI码异常提示2优化多项功能');
CALL Pro_Temp_ColumnWork('basic_product_category', 'deptCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('basic_product_category', 'invCode', 'varchar(255)', 1);

Loading…
Cancel
Save