Compare commits
2 Commits
02d617667c
...
874814822f
| Author | SHA1 | Date |
|---|---|---|
|
|
874814822f | |
|
|
c8b0e17366 |
|
|
@ -45,6 +45,7 @@ public class SupermarketProductController extends BaseController {
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SupermarketProduct supermarketProduct) {
|
public TableDataInfo list(SupermarketProduct supermarketProduct) {
|
||||||
startPage();
|
startPage();
|
||||||
|
System.out.println(supermarketProduct.getMaterialName());
|
||||||
List<SupermarketProduct> list = supermarketProductService.selectSupermarketProductList(supermarketProduct);
|
List<SupermarketProduct> list = supermarketProductService.selectSupermarketProductList(supermarketProduct);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
@ -78,9 +79,9 @@ public class SupermarketProductController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取超市商城商品详细信息")
|
@ApiOperation(value = "获取超市商城商品详细信息")
|
||||||
//@RequiresPermissions("supermarket:product:query")
|
//@RequiresPermissions("supermarket:product:query")
|
||||||
@GetMapping(value = "/{productId}")
|
@PostMapping(value = "/getInfo")
|
||||||
public AjaxResult getInfo(@PathVariable("productId") Long productId) {
|
public AjaxResult getInfo(@RequestBody SupermarketProduct supermarketProduct) {
|
||||||
return success(supermarketProductService.selectSupermarketProductByProductId(productId));
|
return success(supermarketProductService.selectSupermarketProductByProductId(supermarketProduct.getProductId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -89,7 +90,7 @@ public class SupermarketProductController extends BaseController {
|
||||||
@ApiOperation(value = "新增超市商城商品")
|
@ApiOperation(value = "新增超市商城商品")
|
||||||
//@PreventRepeatSubmit
|
//@PreventRepeatSubmit
|
||||||
//@RequiresPermissions("supermarket:product:add")
|
//@RequiresPermissions("supermarket:product:add")
|
||||||
@SysLog(title = "超市商城商品", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增超市商城商品")
|
@SysLog(title = "超市商城商品", businessType = OperaType.INSERT, logType = 1,module = "超市管理->新增超市商城商品")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody SupermarketProduct supermarketProduct) {
|
public AjaxResult add(@RequestBody SupermarketProduct supermarketProduct) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -98,7 +99,50 @@ public class SupermarketProductController extends BaseController {
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 新增超市商城商品
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增超市商城商品")
|
||||||
|
//@PreventRepeatSubmit
|
||||||
|
//@RequiresPermissions("supermarket:product:add")
|
||||||
|
@SysLog(title = "超市商城商品", businessType = OperaType.INSERT, logType = 1,module = "超市管理->新增超市商城商品")
|
||||||
|
@PostMapping("/addProducts")
|
||||||
|
public AjaxResult adds(@RequestBody SupermarketProduct supermarketProduct) {
|
||||||
|
try {
|
||||||
|
return toAjax(supermarketProductService.insertSupermarketProducts(supermarketProduct));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增超市商城商品
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除超市商城商品")
|
||||||
|
//@PreventRepeatSubmit
|
||||||
|
//@RequiresPermissions("supermarket:product:add")
|
||||||
|
@SysLog(title = "超市商城商品", businessType = OperaType.INSERT, logType = 1,module = "超市管理->删除超市商城商品")
|
||||||
|
@PostMapping("/delProduct")
|
||||||
|
public AjaxResult delProduct(@RequestBody SupermarketProduct supermarketProduct) {
|
||||||
|
try {
|
||||||
|
String[] productIds=supermarketProduct.getProductIds().split(",");
|
||||||
|
return toAjax(supermarketProductService.deleteSupermarketProductByProductIdss(productIds));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ApiOperation(value = "超市商城商品批量上线")
|
||||||
|
//@PreventRepeatSubmit
|
||||||
|
//@RequiresPermissions("supermarket:product:add")
|
||||||
|
@SysLog(title = "超市商城商品批量上线", businessType = OperaType.INSERT, logType = 1,module = "超市管理->超市商城商品批量上线")
|
||||||
|
@PostMapping("/onlines")
|
||||||
|
public AjaxResult online(@RequestBody SupermarketProduct supermarketProduct) {
|
||||||
|
try {
|
||||||
|
String[] productIds=supermarketProduct.getProductIds().split(",");
|
||||||
|
return toAjax(supermarketProductService.onlineSupermarketProductByProductIdss(productIds));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 修改超市商城商品
|
* 修改超市商城商品
|
||||||
*/
|
*/
|
||||||
|
|
@ -109,6 +153,8 @@ public class SupermarketProductController extends BaseController {
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
public AjaxResult edit(@RequestBody SupermarketProduct supermarketProduct) {
|
public AjaxResult edit(@RequestBody SupermarketProduct supermarketProduct) {
|
||||||
try {
|
try {
|
||||||
|
System.out.println(supermarketProduct.getPutawayState());
|
||||||
|
System.out.println(supermarketProduct.getIfOnline());
|
||||||
return toAjax(supermarketProductService.updateSupermarketProduct(supermarketProduct));
|
return toAjax(supermarketProductService.updateSupermarketProduct(supermarketProduct));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,8 @@ public class SupermarketProduct extends BaseEntity {
|
||||||
@ApiModelProperty(value = "库存数")
|
@ApiModelProperty(value = "库存数")
|
||||||
private BigDecimal inventoryNum;
|
private BigDecimal inventoryNum;
|
||||||
|
|
||||||
|
private String materialIds;
|
||||||
|
|
||||||
private String materialName;
|
private String materialName;
|
||||||
|
|
||||||
private String materialType;
|
private String materialType;
|
||||||
|
|
@ -85,7 +87,8 @@ public class SupermarketProduct extends BaseEntity {
|
||||||
private String areaName;
|
private String areaName;
|
||||||
|
|
||||||
private String unitName;
|
private String unitName;
|
||||||
|
private String productIds;
|
||||||
|
private String barCode;
|
||||||
public String getImgUrl() {
|
public String getImgUrl() {
|
||||||
return FileUrlUtil.getFileUrl(this.imgUrl);
|
return FileUrlUtil.getFileUrl(this.imgUrl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,4 +60,6 @@ public interface SupermarketProductMapper {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteSupermarketProductByProductIds(Long[] productIds);
|
public int deleteSupermarketProductByProductIds(Long[] productIds);
|
||||||
|
public int deleteSupermarketProductByProductIdss(String[] productIds);
|
||||||
|
public int onlineSupermarketProductByProductIdss(String[] productIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ public interface ISupermarketProductService {
|
||||||
*/
|
*/
|
||||||
public int insertSupermarketProduct(SupermarketProduct supermarketProduct);
|
public int insertSupermarketProduct(SupermarketProduct supermarketProduct);
|
||||||
|
|
||||||
|
public int insertSupermarketProducts(SupermarketProduct supermarketProduct);
|
||||||
/**
|
/**
|
||||||
* 修改超市商城商品
|
* 修改超市商城商品
|
||||||
*
|
*
|
||||||
|
|
@ -51,7 +52,8 @@ public interface ISupermarketProductService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteSupermarketProductByProductIds(Long[] productIds);
|
public int deleteSupermarketProductByProductIds(Long[] productIds);
|
||||||
|
public int deleteSupermarketProductByProductIdss(String[] productIds);
|
||||||
|
public int onlineSupermarketProductByProductIdss(String[] productIds);
|
||||||
/**
|
/**
|
||||||
* 删除超市商城商品信息
|
* 删除超市商城商品信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.canteen.core.supermarket.service.impl;
|
package com.bonus.canteen.core.supermarket.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
|
|
@ -64,6 +65,22 @@ public class SupermarketProductServiceImpl implements ISupermarketProductService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertSupermarketProducts(SupermarketProduct supermarketProduct) {
|
||||||
|
supermarketProduct.setCreateTime(DateUtils.getNowDate());
|
||||||
|
supermarketProduct.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
try {
|
||||||
|
List<SupermarketProduct> sps=new ArrayList<>();
|
||||||
|
sps=supermarketProductMapper.selectSupermarketAddProductList(supermarketProduct);
|
||||||
|
for(SupermarketProduct vo:sps){
|
||||||
|
vo.setSupermarketId(supermarketProduct.getSupermarketId());
|
||||||
|
supermarketProductMapper.insertSupermarketProduct(vo);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 修改超市商城商品
|
* 修改超市商城商品
|
||||||
*
|
*
|
||||||
|
|
@ -91,7 +108,14 @@ public class SupermarketProductServiceImpl implements ISupermarketProductService
|
||||||
public int deleteSupermarketProductByProductIds(Long[] productIds) {
|
public int deleteSupermarketProductByProductIds(Long[] productIds) {
|
||||||
return supermarketProductMapper.deleteSupermarketProductByProductIds(productIds);
|
return supermarketProductMapper.deleteSupermarketProductByProductIds(productIds);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public int deleteSupermarketProductByProductIdss(String[] productIds) {
|
||||||
|
return supermarketProductMapper.deleteSupermarketProductByProductIdss(productIds);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int onlineSupermarketProductByProductIdss(String[] productIds) {
|
||||||
|
return supermarketProductMapper.onlineSupermarketProductByProductIdss(productIds);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 删除超市商城商品信息
|
* 删除超市商城商品信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -26,16 +26,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<sql id="selectSupermarketProductVo">
|
<sql id="selectSupermarketProductVo">
|
||||||
select sp.product_id, sp.supermarket_id, sp.material_id, sp.putaway_state, sp.if_online, sp.sale_price,
|
select sp.product_id, sp.supermarket_id, sp.material_id, sp.putaway_state, sp.if_online, sp.sale_price,
|
||||||
sp.pref_price, sp.person_limit, sp.one_day_limit, sp.img_url, sp.inventory_num, sp.create_by,
|
sp.pref_price, sp.person_limit, sp.one_day_limit, sp.img_url, sp.inventory_num, sp.create_by,
|
||||||
sp.create_time, sp.update_by, sp.update_time, sm.material_name, spu.unit_name
|
sp.create_time, sp.update_by, sp.update_time, sm.material_name,smt.material_type_name, spu.unit_name
|
||||||
from supermarket_product sp
|
from supermarket_product sp
|
||||||
left join supermarket_material sm on sm.material_id = sp.material_id
|
left join supermarket_material sm on sm.material_id = sp.material_id
|
||||||
left join supply_product_unit spu on spu.unit_id = sm.unit_id
|
left join supply_product_unit spu on spu.unit_id = sm.unit_id
|
||||||
|
left join supermarket_material_type smt on smt.material_type_id = sm.material_type_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectSupermarketProductList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketProduct" resultMap="SupermarketProductResult">
|
<select id="selectSupermarketProductList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketProduct" resultMap="SupermarketProductResult">
|
||||||
<include refid="selectSupermarketProductVo"/>
|
<include refid="selectSupermarketProductVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
<if test="barCode != null"> and sm.bar_code like concat('%', #{barCode}, '%')</if>
|
||||||
|
<if test="materialName != null"> and sm.material_name like concat('%', #{materialName}, '%')</if>
|
||||||
<if test="supermarketId != null "> and sp.supermarket_id = #{supermarketId}</if>
|
<if test="supermarketId != null "> and sp.supermarket_id = #{supermarketId}</if>
|
||||||
|
<if test="materialType != null "> and sm.material_type_id = #{materialType}</if>
|
||||||
<if test="materialId != null "> and sp.material_id = #{materialId}</if>
|
<if test="materialId != null "> and sp.material_id = #{materialId}</if>
|
||||||
<if test="putawayState != null "> and sp.putaway_state = #{putawayState}</if>
|
<if test="putawayState != null "> and sp.putaway_state = #{putawayState}</if>
|
||||||
<if test="ifOnline != null "> and sp.if_online = #{ifOnline}</if>
|
<if test="ifOnline != null "> and sp.if_online = #{ifOnline}</if>
|
||||||
|
|
@ -62,6 +66,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
left join supermarket_product sp on sm.material_id=sp.material_id
|
left join supermarket_product sp on sm.material_id=sp.material_id
|
||||||
where sp.material_id is null
|
where sp.material_id is null
|
||||||
<if test="areaId != null and areaId != ''"> and sm.area_id = #{areaId}</if>
|
<if test="areaId != null and areaId != ''"> and sm.area_id = #{areaId}</if>
|
||||||
|
<if test="materialName != null and materialName != ''"> and sm.material_name like concat('%', #{materialName}, '%')</if>
|
||||||
|
<if test="barCode != null and barCode != ''"> and sm.bar_code = #{barCode}</if>
|
||||||
|
<if test="materialIds != null and materialIds != ''"> and sm.material_id in (${materialIds}) </if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSupermarketProductByProductId" parameterType="Long" resultMap="SupermarketProductResult">
|
<select id="selectSupermarketProductByProductId" parameterType="Long" resultMap="SupermarketProductResult">
|
||||||
|
|
@ -144,4 +151,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{productId}
|
#{productId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
<delete id="deleteSupermarketProductByProductIdss" parameterType="String">
|
||||||
|
delete from supermarket_product where product_id in
|
||||||
|
<foreach item="productId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{productId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
<delete id="onlineSupermarketProductByProductIdss" parameterType="String">
|
||||||
|
update supermarket_product set if_online="1" where product_id in
|
||||||
|
<foreach item="productId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{productId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue