Browse Source

5-26 修改添加

master
fkf 2 years ago
parent
commit
eb6b5a4d10
  1. 5
      yxt-supervise-cyf/yxt-supervise-cyf-biz/src/main/java/com/yxt/supervise/cyf/biz/productinformation/ProductInformationMapper.java
  2. 8
      yxt-supervise-cyf/yxt-supervise-cyf-biz/src/main/java/com/yxt/supervise/cyf/biz/productinformation/ProductInformationService.java

5
yxt-supervise-cyf/yxt-supervise-cyf-biz/src/main/java/com/yxt/supervise/cyf/biz/productinformation/ProductInformationMapper.java

@ -24,4 +24,9 @@ public interface ProductInformationMapper extends BaseMapper<ProductInformation>
@Select("select * from product_information")
List<ProductInformation> selectList();
@Select("select count(*) from product_information where number = #{number}")
Integer selectInformationByNumber(@Param("number") String number);
@Select("select count(*) from product_information where name = #{name}")
Integer selectInformationByName(@Param("name") String name);
}

8
yxt-supervise-cyf/yxt-supervise-cyf-biz/src/main/java/com/yxt/supervise/cyf/biz/productinformation/ProductInformationService.java

@ -25,6 +25,14 @@ public class ProductInformationService extends MybatisBaseService<ProductInforma
public ResultBean save(ProductInformationDto dto){
ResultBean rb = ResultBean.fireFail();
Integer integer = baseMapper.selectInformationByNumber(dto.getNumber());
if (integer != 0){
return rb.setMsg("该品牌编码已占用");
}
Integer integer1 = baseMapper.selectInformationByName(dto.getName());
if (integer1 != 0){
return rb.setMsg("该品牌名称已存在");
}
ProductInformation information = new ProductInformation();
BeanUtil.copyProperties(dto,information,"id","sid");
baseMapper.insert(information);

Loading…
Cancel
Save