31 changed files with 810 additions and 85 deletions
@ -0,0 +1,73 @@ |
|||
package com.yxt.goods.apiadmin; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.goods.biz.goodsskusubunit.*; |
|||
import com.yxt.goods.utils.OrgPathQuery; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 15:49 |
|||
*/ |
|||
@Api(tags = "商品品牌") |
|||
@RestController |
|||
@RequestMapping("/apiadmin/base/goodsskusubunit") |
|||
public class GoodsSkuSubunitRest { |
|||
|
|||
@Autowired |
|||
GoodsSkuSubunitService baseBrandInfoService; |
|||
|
|||
@ApiOperation("分页列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<GoodsSkuSubunitVo>> listPage(@RequestBody PagerQuery<GoodsSkuSubunitQuery> pq) { |
|||
return baseBrandInfoService.listPage(pq); |
|||
} |
|||
@ApiOperation("查询所有的品牌") |
|||
@PostMapping("/listAll") |
|||
public ResultBean<List<GoodsSkuSubunitVo>> listAll(@RequestBody OrgPathQuery query) { |
|||
return baseBrandInfoService.listAll(query); |
|||
} |
|||
@ApiOperation("保存修改") |
|||
@PostMapping("/saveOrUpdate") |
|||
public ResultBean<String> saveOrUpdate(@RequestBody GoodsSkuSubunitDto dto) { |
|||
return baseBrandInfoService.saveOrUpdate(dto); |
|||
} |
|||
|
|||
@ApiOperation("初始化") |
|||
@GetMapping("/initialization/{sid}") |
|||
public ResultBean<GoodsSkuSubunitVo> initialization(@PathVariable("sid") String sid) { |
|||
return baseBrandInfoService.initialization(sid); |
|||
} |
|||
|
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable("sid") String sid) { |
|||
return baseBrandInfoService.delete(sid); |
|||
} |
|||
|
|||
@ApiOperation("根据sid批量删除") |
|||
@DeleteMapping("/delBySids") |
|||
public ResultBean delBySids(@RequestBody String[] sids){ |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
baseBrandInfoService.delAll(sids); |
|||
return rb.success(); |
|||
} |
|||
|
|||
@ApiOperation("更改可用状态") |
|||
@GetMapping("/updateIsEnable/{sid}/{isEnable}") |
|||
public ResultBean updateIsEnable(@PathVariable("sid") String sid,@PathVariable("isEnable")String isEnable) { |
|||
return baseBrandInfoService.updateIsEnable(sid,isEnable); |
|||
} |
|||
@ApiOperation("根据品牌名查询") |
|||
@GetMapping("/getBrandByName/{name}") |
|||
public ResultBean<GoodsSkuSubunit> getBrandByName(@PathVariable("name") String name) { |
|||
return baseBrandInfoService.getBrandByName(name); |
|||
} |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.yxt.goods.biz.goodssku; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/12/5 9:01 |
|||
*/ |
|||
@Data |
|||
public class GoodsSkuVo1 { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
private String title;//商品Skutitle
|
|||
private String skuSid;//
|
|||
private String goodsSkuCode;//skuCode
|
|||
private String barCode;//条码
|
|||
private String picUrl;//图片
|
|||
private String salesPrice;//销售价格
|
|||
private String sortNo;//排序
|
|||
private String goodsName;//spuName
|
|||
private String goodsCode;//spuName
|
|||
private String spuSid;//
|
|||
private String unitName;//单位
|
|||
private String unitSid;//
|
|||
private String goodsTypeName;//分类
|
|||
private String typeSid;//
|
|||
private String brandName;//品牌
|
|||
private String brandSid;//
|
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.yxt.goods.biz.goodssku; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/3/21 |
|||
**/ |
|||
@Data |
|||
public class SkuSelectList1 { |
|||
|
|||
//spusid
|
|||
private String goodsSpuSid; |
|||
//商品编码
|
|||
private String goodsCode; |
|||
//商品名称
|
|||
private String goodsName; |
|||
//条形码
|
|||
private String barCode; |
|||
//规格编码
|
|||
private String goodsSkuCode; |
|||
private String goodsSkuSid; |
|||
//规格型号
|
|||
private String title; |
|||
//具体规格
|
|||
private String ownSpec; |
|||
//分类
|
|||
private String typeName; |
|||
private String typeSid; |
|||
//品牌
|
|||
private String brandName; |
|||
private String brandSid; |
|||
//厂家名
|
|||
private String manufacturerSid; |
|||
private String manufacturerName; |
|||
//厂家货号
|
|||
private String factoryCode; |
|||
//单位
|
|||
private String unit; |
|||
private String unitSid; |
|||
//销售单价
|
|||
private BigDecimal salesPrice=new BigDecimal(0); |
|||
|
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.yxt.goods.biz.goodsskusubunit; |
|||
|
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:36 |
|||
*/ |
|||
@Data |
|||
public class GoodsSkuSubunit extends BaseEntity { |
|||
|
|||
private String skuSid;//
|
|||
private String unitName;//计量单位名称
|
|||
private String unitBarCode;//计量单位名称
|
|||
private String ruler;//换算规则(该单位与基础单位的量级关系)数字类型
|
|||
private String price;//销售价格后续害应该包括采购价、销售价、批发价、参考成本等多个价格字段
|
|||
private String weight;//重量
|
|||
private String volume;//体积
|
|||
private String vLength;//长
|
|||
private String vWidth;//宽
|
|||
private String vHeight;//高
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
|
|||
|
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.yxt.goods.biz.goodsskusubunit; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:38 |
|||
*/ |
|||
@Data |
|||
public class GoodsSkuSubunitDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String skuSid;//
|
|||
private String unitName;//计量单位名称
|
|||
private String unitBarCode;//计量单位名称
|
|||
private String ruler;//换算规则(该单位与基础单位的量级关系)数字类型
|
|||
private String price;//销售价格后续害应该包括采购价、销售价、批发价、参考成本等多个价格字段
|
|||
private String weight;//重量
|
|||
private String volume;//体积
|
|||
private String vLength;//长
|
|||
private String vWidth;//宽
|
|||
private String vHeight;//高
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.yxt.goods.biz.goodsskusubunit; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Mapper |
|||
public interface GoodsSkuSubunitMapper extends BaseMapper<GoodsSkuSubunit> { |
|||
int updateBySidIsDelete(List<String> list); |
|||
IPage<GoodsSkuSubunitVo> listPage(IPage<GoodsSkuSubunit> page, @Param(Constants.WRAPPER) QueryWrapper<GoodsSkuSubunit> qw); |
|||
List<GoodsSkuSubunitVo> listAll(@Param("orgPath")String orgPath); |
|||
List<GoodsSkuSubunit> selectBrandNotIn(@Param("names")List<String> names, @Param("orgPath")String orgPath); |
|||
} |
@ -0,0 +1,44 @@ |
|||
<?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.yxt.goods.biz.goodsskusubunit.GoodsSkuSubunitMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="listPage" resultType="com.yxt.goods.biz.goodsskusubunit.GoodsSkuSubunitVo"> |
|||
select |
|||
* |
|||
from goods_brand_info a |
|||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="listAll" resultType="com.yxt.goods.biz.goodsskusubunit.GoodsSkuSubunitVo"> |
|||
select |
|||
* |
|||
from goods_brand_info a |
|||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid |
|||
<where> |
|||
s.orgSidPath like concat('%',#{orgPath},'%') and a.isDelete !='1' and a.isEnable='1' |
|||
</where> |
|||
</select> |
|||
<update id="updateBySidIsDelete"> |
|||
UPDATE goods_brand_info |
|||
SET isDelete=1 |
|||
where sid in |
|||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")"> |
|||
#{item} |
|||
</foreach> |
|||
</update> |
|||
<select id="selectBrandNotIn" resultType="com.yxt.goods.biz.goodsskusubunit.GoodsSkuSubunit"> |
|||
select a.* from goods_brand_info a |
|||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid |
|||
<where> |
|||
a.brandName in |
|||
<foreach collection="names" item="item" index="index" open="(" separator="," close=")"> |
|||
#{item} |
|||
</foreach> |
|||
and s.orgSidPath like concat('%',#{orgPath},'%') and a.isDelete !='1' |
|||
</where> |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,24 @@ |
|||
package com.yxt.goods.biz.goodsskusubunit; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class GoodsSkuSubunitQuery implements Query { |
|||
private String name; |
|||
private String userOrgSid; |
|||
private String createOrgSid;//创建组织sid
|
|||
private String orgLevelKey;//权限等级
|
|||
@ApiModelProperty("菜单路由") |
|||
private String menuUrl; |
|||
@ApiModelProperty("组织全路径sid") |
|||
private String orgPath; |
|||
@ApiModelProperty("用户sid") |
|||
private String userSid; |
|||
private int index; |
|||
} |
@ -0,0 +1,131 @@ |
|||
package com.yxt.goods.biz.goodsskusubunit; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateTime; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.common.base.config.component.FileUploadComponent; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.goods.biz.goodsspu.GoodsSpuDto; |
|||
import com.yxt.goods.utils.OrgPathQuery; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Service |
|||
public class GoodsSkuSubunitService extends MybatisBaseService<GoodsSkuSubunitMapper, GoodsSkuSubunit> { |
|||
@Autowired |
|||
private FileUploadComponent fileUploadComponent; |
|||
|
|||
public ResultBean<PagerVo<GoodsSkuSubunitVo>> listPage(PagerQuery<GoodsSkuSubunitQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
GoodsSkuSubunitQuery query = pq.getParams(); |
|||
QueryWrapper<GoodsSkuSubunit> qw = new QueryWrapper<>(); |
|||
if (StringUtils.isNotBlank(query.getOrgLevelKey())) { |
|||
//数据权限ID(1全部、2本部门及子部门、3本部门、4个人)
|
|||
String orgLevelKey=query.getOrgLevelKey(); |
|||
String orgSidPath=query.getOrgPath(); |
|||
int index=query.getIndex(); |
|||
if ("1".equals(orgLevelKey)) { |
|||
orgSidPath = orgSidPath.substring(0, index); |
|||
qw.like("s.orgSidPath", orgSidPath); |
|||
} else if ("2".equals(orgLevelKey)) { |
|||
orgSidPath = orgSidPath.substring(0, index); |
|||
qw.like("s.orgSidPath", orgSidPath); |
|||
} else if ("3".equals(orgLevelKey)) { |
|||
orgSidPath = orgSidPath.substring(0, index); |
|||
qw.apply("s.orgSidPath like('"+orgSidPath+"')"); |
|||
} else if ("4".equals(orgLevelKey)) { |
|||
qw.eq("a.createBySid", query.getUserSid()); |
|||
} else { |
|||
PagerVo<GoodsSkuSubunitVo> p = new PagerVo<>(); |
|||
return rb.success().setData(p); |
|||
} |
|||
} else { |
|||
PagerVo<GoodsSkuSubunitVo> p = new PagerVo<>(); |
|||
return rb.success().setData(p); |
|||
} |
|||
if(StringUtils.isNotBlank(query.getName())){ |
|||
qw.like("a.brandName",query.getName()); |
|||
} |
|||
qw.ne("a.isDelete","1"); |
|||
IPage<GoodsSkuSubunit> page = PagerUtil.queryToPage(pq); |
|||
IPage<GoodsSkuSubunitVo> pagging = baseMapper.listPage(page, qw); |
|||
PagerVo<GoodsSkuSubunitVo> p = PagerUtil.pageToVo(pagging, null); |
|||
List<GoodsSkuSubunitVo> records = pagging.getRecords(); |
|||
records.removeAll(Collections.singleton(null)); |
|||
return rb.success().setData(p); |
|||
} |
|||
public ResultBean<List<GoodsSkuSubunitVo>> listAll(OrgPathQuery query) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<GoodsSkuSubunitVo> pagging = baseMapper.listAll(query.getOrgPath()); |
|||
return rb.success().setData(pagging); |
|||
} |
|||
public ResultBean<String> saveOrUpdate(GoodsSkuSubunitDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
String sid = dto.getSid(); |
|||
if (StringUtils.isNotBlank(dto.getSid())) { |
|||
GoodsSkuSubunit wmsGoodsBrand = fetchBySid(dto.getSid()); |
|||
BeanUtil.copyProperties(dto, wmsGoodsBrand, "id", "sid"); |
|||
wmsGoodsBrand.setModifyTime(new Date()); |
|||
baseMapper.updateById(wmsGoodsBrand); |
|||
} else { |
|||
GoodsSkuSubunit wmsGoodsBrand = new GoodsSkuSubunit(); |
|||
sid = wmsGoodsBrand.getSid(); |
|||
BeanUtil.copyProperties(dto, wmsGoodsBrand, "id", "sid"); |
|||
wmsGoodsBrand.setCreateTime(new DateTime()); |
|||
baseMapper.insert(wmsGoodsBrand); |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
|
|||
public ResultBean<GoodsSkuSubunitVo> initialization(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
GoodsSkuSubunitVo vo = new GoodsSkuSubunitVo(); |
|||
GoodsSkuSubunit wmsGoodsBrand = fetchBySid(sid); |
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|||
BeanUtil.copyProperties(wmsGoodsBrand, vo); |
|||
return rb.success().setData(vo); |
|||
} |
|||
|
|||
|
|||
|
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
GoodsSkuSubunit wmsGoodsBrand = fetchBySid(sid); |
|||
if (null != wmsGoodsBrand) { |
|||
baseMapper.deleteById(wmsGoodsBrand.getId()); |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
public void delAll(String[] sids) { |
|||
int count = baseMapper.updateBySidIsDelete(Arrays.stream(sids).collect(Collectors.toList())); |
|||
} |
|||
public ResultBean updateIsEnable(String sid,String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
GoodsSkuSubunit wmsGoodsBrand = fetchBySid(sid); |
|||
if (null != wmsGoodsBrand) { |
|||
wmsGoodsBrand.setIsEnable(Integer.parseInt(isEnable)); |
|||
baseMapper.updateById(wmsGoodsBrand); |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
public ResultBean<GoodsSkuSubunit> getBrandByName(String name) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
GoodsSkuSubunit type=baseMapper.selectOne(new QueryWrapper<GoodsSkuSubunit>().eq("brandName",name)); |
|||
return rb.success().setData(type); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.yxt.goods.biz.goodsskusubunit; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class GoodsSkuSubunitVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
private String skuSid;//
|
|||
private String unitName;//计量单位名称
|
|||
private String unitBarCode;//计量单位名称
|
|||
private String ruler;//换算规则(该单位与基础单位的量级关系)数字类型
|
|||
private String price;//销售价格后续害应该包括采购价、销售价、批发价、参考成本等多个价格字段
|
|||
private String weight;//重量
|
|||
private String volume;//体积
|
|||
private String vLength;//长
|
|||
private String vWidth;//宽
|
|||
private String vHeight;//高
|
|||
} |
Loading…
Reference in new issue