Commit 74a8054b by XiaHou

权星修复相关接口

parent 8d41efbd
......@@ -9,7 +9,11 @@ import com.macro.mall.domain.vo.product.PmsProductParam;
import com.macro.mall.domain.vo.product.PmsProductResult;
import com.macro.mall.domain.vo.product.SimpleProductResult;
import com.macro.mall.dto.*;
import com.macro.mall.model.PmsProduct;
import com.macro.mall.model.UmsMember;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.PmsSupplierAuditDto;
import com.macro.mall.model.dto.quanxing.common.BatchOperationDto;
import com.macro.mall.service.product.PmsProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -26,7 +30,7 @@ import java.util.List;
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "商品管理", description = "商品管理")
@Api(tags = "权星后台_商品相关接口", description = "商品管理")
@RequestMapping("/product")
public class PmsProductController {
@Resource
......@@ -68,132 +72,46 @@ public class PmsProductController {
return CommonResult.failed(res.getMsg());
}
@ApiOperation("查询商品")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation("权星后台_商品分页查询")
@ResponseBody
//@PreAuthorize("hasAuthority('pms:product:read')")
public CommonResult<CommonPage<PmsProductListResult>> getList(@ModelAttribute PmsProductQueryParam productQueryParam,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<PmsProductListResult> productList = productService.list(productQueryParam, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(productList));
}
@ApiOperation("根据商品名称或货号模糊查询")
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<SimpleProductResult>> getList(String keyword, Long catetoryI, Long catetoryIi, Long catetoryIii, Long mchtId) {
List<SimpleProductResult> productList = productService.list(keyword,catetoryI,catetoryIi,catetoryIii,mchtId);
return CommonResult.success(productList);
@RequestMapping(value = "/getPageList", method = RequestMethod.POST)
public CommonResult<CommonPage<PmsProduct>> getPageList(@ApiParam("页数") @RequestParam("page")Integer page, @ApiParam("每页大小")@RequestParam("size")Integer size,
@ApiParam("模糊查询商品名称 ")@RequestParam("name") String name){
return CommonResult.success(CommonPage.restPage(this.productService.getPageList(page,size,name)));
}
@ApiOperation("批量修改审核状态")
@RequestMapping(value = "/update/verifyStatus", method = RequestMethod.POST)
@ApiOperation("权星后台_根据商品id修改一条商品数据")
@RequestMapping(value = "/updateOneById", method = RequestMethod.POST)
@ResponseBody
//@PreAuthorize("hasAuthority('pms:product:update')")
public CommonResult updateVerifyStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("verifyStatus") Integer verifyStatus,
@RequestParam("detail") String detail) {
int count = productService.updateVerifyStatus(ids, verifyStatus, detail);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
public CommonResult updateOneById(@ApiParam("商品对象,传入Id,以及对应的要修改的值.例如上架状态:0->下架;1->上架' 传入0为下架操作") @RequestBody PmsProduct pmsProduct){
ResultMsg res = this.productService.updateOneById(pmsProduct);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
@ApiOperation("批量上下架")
@RequestMapping(value = "/update/publishStatus", method = RequestMethod.POST)
@ApiOperation("权星后台_传入商品ids集合 批量删除")
@RequestMapping(value = "/batchOperationByDelete", method = RequestMethod.POST)
@ResponseBody
//@PreAuthorize("hasAuthority('pms:product:update')")
public CommonResult updatePublishStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("publishStatus") Integer publishStatus) {
int count = productService.updatePublishStatus(ids, publishStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
public CommonResult batchOperationByDelete(@ApiParam("接收对象") @RequestBody BatchOperationDto batchOperationDto){
ResultMsg res = this.productService.batchOperationByDelete(batchOperationDto);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
// @ApiOperation("批量推荐商品")
// @RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
// @ResponseBody
// //@PreAuthorize("hasAuthority('pms:product:update')")
// public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids,
// @RequestParam("recommendStatus") Integer recommendStatus) {
// int count = productService.updateRecommendStatus(ids, recommendStatus);
// if (count > 0) {
// return CommonResult.success(count);
// } else {
// return CommonResult.failed();
// }
// }
// @ApiOperation("批量设为新品")
// @RequestMapping(value = "/update/newStatus", method = RequestMethod.POST)
// @ResponseBody
// //@PreAuthorize("hasAuthority('pms:product:update')")
// public CommonResult updateNewStatus(@RequestParam("ids") List<Long> ids,
// @RequestParam("newStatus") Integer newStatus) {
// int count = productService.updateNewStatus(ids, newStatus);
// if (count > 0) {
// return CommonResult.success(count);
// } else {
// return CommonResult.failed();
// }
// }
@ApiOperation("批量修改删除状态")
@RequestMapping(value = "/update/deleteStatus", method = RequestMethod.POST)
@ApiOperation("权星后台_传入商品ids集合 批量上架或者下架")
@RequestMapping(value = "/batchOperationByPublishStatus", method = RequestMethod.POST)
@ResponseBody
//@PreAuthorize("hasAuthority('pms:product:delete')")
public CommonResult updateDeleteStatus(@RequestParam("ids") List<Long> ids,
@ApiParam("删除类型 1删除(彻底删除) 2删除(可以还原)3还原商品") @RequestParam("deleteStatus") Integer deleteStatus) {
int count = productService.updateDeleteStatus(ids, deleteStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
public CommonResult batchOperationByPublishStatus(@ApiParam("接收对象") @RequestBody BatchOperationDto batchOperationDto){
ResultMsg res = this.productService.batchOperationByPublishStatus(batchOperationDto);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
@ApiOperation("复制商品")
@RequestMapping(value = "/saveCopyProduct", method = RequestMethod.POST)
@ResponseBody
// //@PreAuthorize("hasAuthority('pms:product:save')")
public CommonResult saveCopyProduct(@RequestParam Long productId) {
int count = productService.saveCopyProduct(productId);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("批量移动商品到新分类")
@RequestMapping(value = "/updateMoveProduct", method = RequestMethod.POST)
@ResponseBody
//@PreAuthorize("hasAuthority('pms:product:update')")
public CommonResult updateMoveProduct(@RequestParam List<Long> productIds,@RequestParam Long categoryIdI,@RequestParam Long categoryIdIi,@RequestParam(required = false) Long categoryIdIii) {
int count = productService.updateMoveProduct(productIds,categoryIdI,categoryIdIi,categoryIdIii);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("批量修改商品标签")
@RequestMapping(value = "/updateProductLabel", method = RequestMethod.POST)
@ResponseBody
//@PreAuthorize("hasAuthority('pms:product:update')")
public CommonResult updateProductLabel(@RequestBody ProductLableParam productLableParam) {
int count = productService.updateProductLabel(productLableParam.getProductIds(),productLableParam.getPmsProductLabelRelations());
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
}
package com.macro.mall.controller.quanxing;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.PmsSupplierAuditDto;
......@@ -34,9 +35,9 @@ public class PmsSupplierAuditController {
@ApiOperation("权星后台_申请供应商分页数据")
@ResponseBody
@RequestMapping(value = "/getPageList", method = RequestMethod.POST)
public CommonResult getPageList(@ApiParam("页数") @RequestParam("page")Integer page,@ApiParam("每页大小")@RequestParam("size")Integer size,
@ApiParam("(非必传)审核状态 0待审核 1审核通过 2审核不通过")@RequestParam("status") Integer status){
return CommonResult.success(this.pmsSupplierAuditService.getPageList(page,size,status));
public CommonResult<CommonPage<PmsSupplierAuditDto>> getPageList(@ApiParam("页数") @RequestParam("page")Integer page, @ApiParam("每页大小")@RequestParam("size")Integer size,
@ApiParam("供应商名称")@RequestParam("name") String name, @ApiParam("手机号")@RequestParam("phone") String phone){
return CommonResult.success(CommonPage.restPage(this.pmsSupplierAuditService.getPageList(page,size,name,phone)));
}
@ApiOperation("权星后台_通过审核Id得到 相关数据")
......
......@@ -13,6 +13,9 @@ public class PmsSupplierAudit implements Serializable {
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@ApiModelProperty(value = "供应商名称")
private String name;
@ApiModelProperty(value = "品牌名称")
private String brandName;
......@@ -64,6 +67,14 @@ public class PmsSupplierAudit implements Serializable {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBrandName() {
return brandName;
}
......@@ -175,6 +186,7 @@ public class PmsSupplierAudit implements Serializable {
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", brandName=").append(brandName);
sb.append(", companyName=").append(companyName);
sb.append(", businessLicense=").append(businessLicense);
......
......@@ -165,6 +165,76 @@ public class PmsSupplierAuditExample {
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andBrandNameIsNull() {
addCriterion("brand_name is null");
return (Criteria) this;
......
......@@ -106,24 +106,21 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.PmsProductSkuValue">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into pms_product_sku_value (product_id, product_attribute_id, value,
attribute_group_id, create_date, create_by,
update_date, update_by, delete_status
)
values (#{productId,jdbcType=BIGINT}, #{productAttributeId,jdbcType=BIGINT}, #{value,jdbcType=VARCHAR},
#{attributeGroupId,jdbcType=BIGINT}, #{createDate,jdbcType=TIMESTAMP}, #{createBy,jdbcType=BIGINT},
#{updateDate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT}, #{deleteStatus,jdbcType=INTEGER}
)
insert into pms_product_sku_value (id, product_id, product_attribute_id,
value, attribute_group_id, create_date,
create_by, update_date, update_by,
delete_status)
values (#{id,jdbcType=BIGINT}, #{productId,jdbcType=BIGINT}, #{productAttributeId,jdbcType=BIGINT},
#{value,jdbcType=VARCHAR}, #{attributeGroupId,jdbcType=BIGINT}, #{createDate,jdbcType=TIMESTAMP},
#{createBy,jdbcType=BIGINT}, #{updateDate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT},
#{deleteStatus,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.PmsProductSkuValue">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into pms_product_sku_value
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="productId != null">
product_id,
</if>
......@@ -153,6 +150,9 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="productId != null">
#{productId,jdbcType=BIGINT},
</if>
......
......@@ -3,6 +3,7 @@
<mapper namespace="com.macro.mall.mapper.PmsSupplierAuditMapper">
<resultMap id="BaseResultMap" type="com.macro.mall.model.PmsSupplierAudit">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="brand_name" jdbcType="VARCHAR" property="brandName" />
<result column="company_name" jdbcType="VARCHAR" property="companyName" />
<result column="business_license" jdbcType="VARCHAR" property="businessLicense" />
......@@ -76,7 +77,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, brand_name, company_name, business_license, business, trademark, other_materials,
id, name, brand_name, company_name, business_license, business, trademark, other_materials,
phone, password, status, remarks, delete_status, createtime, updatetime
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.PmsSupplierAuditExample" resultMap="BaseResultMap">
......@@ -110,26 +111,28 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.PmsSupplierAudit">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into pms_supplier_audit (brand_name, company_name, business_license,
business, trademark, other_materials,
phone, password, status,
remarks, delete_status, createtime,
updatetime)
values (#{brandName,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR}, #{businessLicense,jdbcType=VARCHAR},
#{business,jdbcType=VARCHAR}, #{trademark,jdbcType=VARCHAR}, #{otherMaterials,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{remarks,jdbcType=VARCHAR}, #{deleteStatus,jdbcType=INTEGER}, #{createtime,jdbcType=TIMESTAMP},
#{updatetime,jdbcType=TIMESTAMP})
insert into pms_supplier_audit (id, name, brand_name,
company_name, business_license, business,
trademark, other_materials, phone,
password, status, remarks,
delete_status, createtime, updatetime
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{brandName,jdbcType=VARCHAR},
#{companyName,jdbcType=VARCHAR}, #{businessLicense,jdbcType=VARCHAR}, #{business,jdbcType=VARCHAR},
#{trademark,jdbcType=VARCHAR}, #{otherMaterials,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{remarks,jdbcType=VARCHAR},
#{deleteStatus,jdbcType=INTEGER}, #{createtime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.PmsSupplierAudit">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into pms_supplier_audit
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="brandName != null">
brand_name,
</if>
......@@ -171,6 +174,12 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="brandName != null">
#{brandName,jdbcType=VARCHAR},
</if>
......@@ -224,6 +233,9 @@
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.brandName != null">
brand_name = #{record.brandName,jdbcType=VARCHAR},
</if>
......@@ -271,6 +283,7 @@
<update id="updateByExample" parameterType="map">
update pms_supplier_audit
set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
brand_name = #{record.brandName,jdbcType=VARCHAR},
company_name = #{record.companyName,jdbcType=VARCHAR},
business_license = #{record.businessLicense,jdbcType=VARCHAR},
......@@ -291,6 +304,9 @@
<update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.PmsSupplierAudit">
update pms_supplier_audit
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="brandName != null">
brand_name = #{brandName,jdbcType=VARCHAR},
</if>
......@@ -335,7 +351,8 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.PmsSupplierAudit">
update pms_supplier_audit
set brand_name = #{brandName,jdbcType=VARCHAR},
set name = #{name,jdbcType=VARCHAR},
brand_name = #{brandName,jdbcType=VARCHAR},
company_name = #{companyName,jdbcType=VARCHAR},
business_license = #{businessLicense,jdbcType=VARCHAR},
business = #{business,jdbcType=VARCHAR},
......
......@@ -12,8 +12,10 @@ import com.macro.mall.domain.vo.product.PmsProductListResult;
import com.macro.mall.domain.vo.product.PmsProductParam;
import com.macro.mall.domain.vo.product.PmsProductResult;
import com.macro.mall.domain.vo.product.SimpleProductResult;
import com.macro.mall.model.PmsProduct;
import com.macro.mall.model.PmsProductLabelRelation;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.quanxing.common.BatchOperationDto;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
......@@ -165,4 +167,34 @@ public interface PmsProductService {
* @return
*/
ResultMsg addProduct(PmsProductRequestParam pmsProductRequestParam);
/**
* 商品分页查询
* @param pageNum
* @param pageSize
* @param name
* @return
*/
List<PmsProduct> getPageList(Integer pageNum,Integer pageSize,String name);
/**
* 根据Id修改传入参数
* @param pmsProduct
* @return
*/
ResultMsg updateOneById(PmsProduct pmsProduct);
/**
* 批量删除操作
* @param batchOperationDto
* @return
*/
ResultMsg batchOperationByDelete(BatchOperationDto batchOperationDto);
/**
* 批量启用禁用操作
* @param batchOperationDto
* @return
*/
ResultMsg batchOperationByPublishStatus(BatchOperationDto batchOperationDto);
}
......@@ -22,6 +22,7 @@ import com.macro.mall.domain.vo.product.SimpleProductResult;
import com.macro.mall.mapper.*;
import com.macro.mall.model.*;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.quanxing.common.BatchOperationDto;
import com.macro.mall.repository.PmsCommentRepository;
import com.macro.mall.repository.PmsProductLabelRelationRepository;
import com.macro.mall.repository.PmsProductWholesalePriceRepository;
......@@ -36,6 +37,7 @@ import com.macro.mall.service.product.PmsProductService;
import com.macro.mall.service.promotion.SmsFullReductionPromotionService;
import com.macro.mall.service.promotion.SmsSeckillPromotionService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
......@@ -771,4 +773,104 @@ public class PmsProductServiceImpl implements PmsProductService {
int count = pmsProductMapper.updateByExampleSelective(p,example);
log.info("定时更新商品上架状态共:{}条",count);
}
/**
* 商品分页查询
* @param pageNum
* @param pageSize
* @param name
* @return
*/
@Override
public List<PmsProduct> getPageList(Integer pageNum,Integer pageSize,String name){
PageHelper.startPage(pageNum, pageSize);
PmsProductExample example = new PmsProductExample();
PmsProductExample.Criteria criteria = example.createCriteria();
if(name != null && !"".equals(name)){
criteria.andNameLike("%"+"name"+"%");
}
return this.pmsProductMapper.selectByExample(example);
}
/**
* 根据Id修改传入参数
* @param pmsProduct
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg updateOneById(PmsProduct pmsProduct){
if(pmsProduct.getId() ==null){
return new ResultMsg(false,"传入id为空");
}
this.pmsProductMapper.updateByPrimaryKeySelective(pmsProduct);
return new ResultMsg(true,"操作成功");
}
/**
* 批量删除操作
* @param batchOperationDto
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg batchOperationByDelete(BatchOperationDto batchOperationDto){
if(batchOperationDto.getIds() == null || "".equals(batchOperationDto.getIds())){
return new ResultMsg(false,"传入id集合为空!");
}
if(batchOperationDto.getStatus() == null){
return new ResultMsg(false,"传入状态为空!");
}
if(batchOperationDto.getIsDelete() == null){
return new ResultMsg(false,"传入是否真删为空!");
}
List idList = Arrays.asList(batchOperationDto.getIds().split(","));//根据逗号分隔转化为list
if(batchOperationDto.getIsDelete() == 1){//如果为真删除
idList.forEach(id ->{
this.pmsProductMapper.deleteByPrimaryKey((Long)id);
});
}else{//假删除 操作
PmsProduct pmsProduct = new PmsProduct();
pmsProduct.setDeleteStatus(batchOperationDto.getStatus());
idList.forEach(id ->{
pmsProduct.setId((Long)id);
this.pmsProductMapper.updateByPrimaryKeySelective(pmsProduct);
});
}
return new ResultMsg(true,"操作成功");
}
/**
* 批量上下架操作
* @param batchOperationDto
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg batchOperationByPublishStatus(BatchOperationDto batchOperationDto){
if(batchOperationDto.getIds() == null || "".equals(batchOperationDto.getIds())){
return new ResultMsg(false,"传入id集合为空!");
}
if(batchOperationDto.getStatus() == null){
return new ResultMsg(false,"传入状态为空!");
}
if(batchOperationDto.getIsDelete() == null){
return new ResultMsg(false,"传入是否真删为空!");
}
List idList = Arrays.asList(batchOperationDto.getIds().split(","));//根据逗号分隔转化为list
if(batchOperationDto.getIsDelete() == 1){//如果为真删除
idList.forEach(id ->{
this.pmsProductMapper.deleteByPrimaryKey((Long)id);
});
}else{//假删除 操作
PmsProduct pmsProduct = new PmsProduct();
pmsProduct.setPublishStatus(batchOperationDto.getStatus());
idList.forEach(id ->{
pmsProduct.setId((Long)id);
this.pmsProductMapper.updateByPrimaryKeySelective(pmsProduct);
});
}
return new ResultMsg(true,"操作成功");
}
}
......@@ -30,10 +30,11 @@ public interface IPmsSupplierAuditService {
* 分页查询
* @param page
* @param size
* @param status
* @param name
* @param phone
* @return
*/
List<PmsSupplierAuditDto> getPageList(Integer page,Integer size,Integer status);
List<PmsSupplierAuditDto> getPageList(Integer page,Integer size,String name,String phone);
/**
* 根据id获取一条审核记录
......
......@@ -67,7 +67,11 @@ public class PmsSupplierAuditServiceImpl implements IPmsSupplierAuditService {
UmsMember umsMember = new UmsMember();
umsMember.setUsername(this.getUsername());//系统根据时间生成账号
String uuid = UUID.randomUUID().toString().replace("-", ""); //随机生成昵称 转化为String对象 因为UUID本身为32位只是生成时多了“-”,所以将它们去除
umsMember.setName(uuid.substring(4, 12));
if(psa.getName() ==null || "".equals(psa.getName())){
umsMember.setName(uuid.substring(4, 12));
}else{
umsMember.setName(psa.getName());
}
umsMember.setPhone(psa.getPhone());
umsMember.setPassword(psa.getPassword());
umsMember.setStatus(1);//帐号启用状态:0->禁用;1->启用
......@@ -162,12 +166,15 @@ public class PmsSupplierAuditServiceImpl implements IPmsSupplierAuditService {
@Override
public List<PmsSupplierAuditDto> getPageList(Integer page, Integer size, Integer status){
PageHelper.startPage(page, size);
public List<PmsSupplierAuditDto> getPageList(Integer pageNum, Integer pageSize, String name,String phone){
PageHelper.startPage(pageNum, pageSize);
PmsSupplierAuditExample example = new PmsSupplierAuditExample();
PmsSupplierAuditExample.Criteria criteria = example.createCriteria();
if(status !=null){ //如果存在查询状态 则传入
criteria.andStatusEqualTo(status);
if(name != null && !"".equals(name)){
criteria.andNameLike("name"+"%");
}
if(phone != null && !"".equals(phone)){
criteria.andPhoneEqualTo(phone);
}
//过滤已删除的数据
criteria.andDeleteStatusEqualTo(0);//删除标识0 未删除 1已删除
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment