¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.api.business; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.CateParamSelect; |
| | | import com.doumee.service.CateParamSelectService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/09/11 14:45 |
| | | */ |
| | | @Api(tags = "åç±»åæ°çé项信æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping("/cateParamSelect") |
| | | public class CateParamSelectController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CateParamSelectService cateParamSelectService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:create") |
| | | public ApiResponse create(@RequestBody CateParamSelect cateParamSelect) { |
| | | return ApiResponse.success(cateParamSelectService.create(cateParamSelect)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | cateParamSelectService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | cateParamSelectService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:update") |
| | | public ApiResponse updateById(@RequestBody CateParamSelect cateParamSelect) { |
| | | cateParamSelectService.updateById(cateParamSelect); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:query") |
| | | public ApiResponse<PageData<CateParamSelect>> findPage (@RequestBody PageWrap<CateParamSelect> pageWrap) { |
| | | return ApiResponse.success(cateParamSelectService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<CateParamSelect> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(CateParamSelect.class).export(cateParamSelectService.findPage(pageWrap).getRecords(), "åç±»åæ°çé项信æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(cateParamSelectService.findById(id)); |
| | | } |
| | | } |
| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.Goods; |
| | | import com.doumee.dao.business.model.dto.GoodCreatePlatRequest; |
| | | import com.doumee.dao.business.model.dto.GoodsRequest; |
| | | import com.doumee.service.business.GoodsService; |
| | | import io.swagger.annotations.*; |
| | |
| | | public ApiResponse create(@RequestBody Goods goods) { |
| | | return ApiResponse.success(goodsService.create(goods)); |
| | | } |
| | | @PreventRepeat |
| | | @ApiOperation("ä»å¹³å°éæ©åå") |
| | | @PostMapping("/createPlat") |
| | | @RequiresPermissions("business:goods:create") |
| | | public ApiResponse createPlat(@RequestBody GoodCreatePlatRequest param) { |
| | | return ApiResponse.success(goodsService.createPlat(param)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
¶Ô±ÈÐÂÎļþ |
| | |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:create', 'æ°å»ºåç±»åæ°çé项信æ¯è¡¨', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:delete', 'å é¤åç±»åæ°çé项信æ¯è¡¨', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:update', 'ä¿®æ¹åç±»åæ°çé项信æ¯è¡¨', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:query', 'æ¥è¯¢åç±»åæ°çé项信æ¯è¡¨', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('cateparamselect:cateparamselect:exportExcel', '导åºåç±»åæ°çé项信æ¯è¡¨(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.api.business; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.CateParamSelect; |
| | | import com.doumee.service.CateParamSelectService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/09/11 14:45 |
| | | */ |
| | | @Api(tags = "åç±»åæ°çé项信æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping("/cateParamSelect") |
| | | public class CateParamSelectController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CateParamSelectService cateParamSelectService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:create") |
| | | public ApiResponse create(@RequestBody CateParamSelect cateParamSelect) { |
| | | return ApiResponse.success(cateParamSelectService.create(cateParamSelect)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | cateParamSelectService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | cateParamSelectService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:update") |
| | | public ApiResponse updateById(@RequestBody CateParamSelect cateParamSelect) { |
| | | cateParamSelectService.updateById(cateParamSelect); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:query") |
| | | public ApiResponse<PageData<CateParamSelect>> findPage (@RequestBody PageWrap<CateParamSelect> pageWrap) { |
| | | return ApiResponse.success(cateParamSelectService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<CateParamSelect> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(CateParamSelect.class).export(cateParamSelectService.findPage(pageWrap).getRecords(), "åç±»åæ°çé项信æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @RequiresPermissions("cateparamselect:cateparamselect:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(cateParamSelectService.findById(id)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.business; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.doumee.dao.business.model.CateParamSelect; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/09/11 14:45 |
| | | */ |
| | | public interface CateParamSelectMapper extends BaseMapper<CateParamSelect> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * åç±»åæ°çé项信æ¯è¡¨ |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/09/11 14:45 |
| | | */ |
| | | @Data |
| | | @ApiModel("åç±»åæ°çé项信æ¯è¡¨") |
| | | @TableName("`cate_param_select`") |
| | | public class CateParamSelect { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @ApiModelProperty(value = "主é®", example = "1") |
| | | @ExcelColumn(name="主é®") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "å建人ç¼ç ", example = "1") |
| | | @ExcelColumn(name="å建人ç¼ç ") |
| | | private Integer creator; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @ExcelColumn(name="å建æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date createDate; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°äººç¼ç ", example = "1") |
| | | @ExcelColumn(name="æ´æ°äººç¼ç ") |
| | | private Integer editor; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | @ExcelColumn(name="æ´æ°æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date editDate; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦å é¤0å¦ 1æ¯", example = "1") |
| | | @ExcelColumn(name="æ¯å¦å é¤0å¦ 1æ¯") |
| | | private Integer isdeleted; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | @ExcelColumn(name="夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "屿§å¼") |
| | | @ExcelColumn(name="屿§å¼") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "æå±åæ°é
ç½®ç¼ç (å
³ècate_param表)", example = "1") |
| | | @ExcelColumn(name="æå±åæ°é
ç½®ç¼ç (å
³ècate_param表)") |
| | | private Integer paramId; |
| | | |
| | | @ApiModelProperty(value = "æå±åç±»ç¼ç (å
³ècategory表)", example = "1") |
| | | @ExcelColumn(name="æå±åç±»ç¼ç (å
³ècategory表)") |
| | | private Integer categoryId; |
| | | |
| | | @ApiModelProperty(value = "ç¶æ 0å¯ç¨ 1ç¦ç¨", example = "1") |
| | | @ExcelColumn(name="ç¶æ 0å¯ç¨ 1ç¦ç¨") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "æåºç ", example = "1") |
| | | @ExcelColumn(name="æåºç ") |
| | | private Integer sortnum; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.business.model.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by IntelliJ IDEA. |
| | | * |
| | | * @Author : JP |
| | | * @create 2023/6/7 15:09 |
| | | */ |
| | | @Data |
| | | public class GoodCreatePlatRequest { |
| | | |
| | | @ApiModelProperty(value = "ç±»å«ç¼ç ",example = "1") |
| | | private Integer categoryId; |
| | | @ApiModelProperty(value = "ååèå´ 0å
¨é¨ 1é¨å",example = "1") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "å ä»·ç³»æ°",example = "1") |
| | | private BigDecimal rate; |
| | | |
| | | @ApiModelProperty(value = "åç主é®") |
| | | private List<PlatGoodsParam> goodsParamList; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.business.model.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * Created by IntelliJ IDEA. |
| | | * |
| | | * @Author : JP |
| | | * @create 2023/6/7 15:09 |
| | | */ |
| | | @Data |
| | | public class PlatGoodsParam { |
| | | |
| | | @ApiModelProperty(value = "ååç¼ç ",example = "1") |
| | | private Integer goodsId; |
| | | |
| | | @ApiModelProperty(value = "å
¥æä»·æ ¼ å
",example = "1") |
| | | private BigDecimal price; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.service; |
| | | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.CateParamSelect; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åç±»åæ°çé项信æ¯è¡¨Serviceå®ä¹ |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/09/11 14:45 |
| | | */ |
| | | public interface CateParamSelectService { |
| | | |
| | | /** |
| | | * å建 |
| | | * |
| | | * @param cateParamSelect å®ä½å¯¹è±¡ |
| | | * @return Integer |
| | | */ |
| | | Integer create(CateParamSelect cateParamSelect); |
| | | |
| | | /** |
| | | * 主é®å é¤ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | void deleteById(Integer id); |
| | | |
| | | /** |
| | | * å é¤ |
| | | * |
| | | * @param cateParamSelect å®ä½å¯¹è±¡ |
| | | */ |
| | | void delete(CateParamSelect cateParamSelect); |
| | | |
| | | /** |
| | | * æ¹é主é®å é¤ |
| | | * |
| | | * @param ids 主é®é |
| | | */ |
| | | void deleteByIdInBatch(List<Integer> ids); |
| | | |
| | | /** |
| | | * 䏻鮿´æ° |
| | | * |
| | | * @param cateParamSelect å®ä½å¯¹è±¡ |
| | | */ |
| | | void updateById(CateParamSelect cateParamSelect); |
| | | |
| | | /** |
| | | * æ¹é䏻鮿´æ° |
| | | * |
| | | * @param cateParamSelects å®ä½é |
| | | */ |
| | | void updateByIdInBatch(List<CateParamSelect> cateParamSelects); |
| | | |
| | | /** |
| | | * 䏻鮿¥è¯¢ |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return CateParamSelect |
| | | */ |
| | | CateParamSelect findById(Integer id); |
| | | |
| | | /** |
| | | * æ¡ä»¶æ¥è¯¢åæ¡è®°å½ |
| | | * |
| | | * @param cateParamSelect å®ä½å¯¹è±¡ |
| | | * @return CateParamSelect |
| | | */ |
| | | CateParamSelect findOne(CateParamSelect cateParamSelect); |
| | | |
| | | /** |
| | | * æ¡ä»¶æ¥è¯¢ |
| | | * |
| | | * @param cateParamSelect å®ä½å¯¹è±¡ |
| | | * @return List<CateParamSelect> |
| | | */ |
| | | List<CateParamSelect> findList(CateParamSelect cateParamSelect); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param pageWrap å页对象 |
| | | * @return PageData<CateParamSelect> |
| | | */ |
| | | PageData<CateParamSelect> findPage(PageWrap<CateParamSelect> pageWrap); |
| | | |
| | | /** |
| | | * æ¡ä»¶ç»è®¡ |
| | | * |
| | | * @param cateParamSelect å®ä½å¯¹è±¡ |
| | | * @return long |
| | | */ |
| | | long count(CateParamSelect cateParamSelect); |
| | | } |
| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.Goods; |
| | | import com.doumee.dao.business.model.dto.GoodCreatePlatRequest; |
| | | import com.doumee.dao.business.model.dto.GoodsRequest; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | PageData<Goods> getGoodsPage(PageWrap<GoodsRequest> pageWrap); |
| | | |
| | | List<Goods> findListForH5(GoodsRequest goodsRequest); |
| | | |
| | | Integer createPlat(GoodCreatePlatRequest param); |
| | | } |
| | |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.join.GoodsJoinMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.model.dto.GoodCreatePlatRequest; |
| | | import com.doumee.dao.business.model.dto.GoodsRequest; |
| | | import com.doumee.service.business.GoodsService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | |
| | | |
| | | return goods.getId(); |
| | | } |
| | | @Override |
| | | public Integer createPlat(GoodCreatePlatRequest param){ |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(Constants.equalsInteger(user.getType(), Constants.UserType.COMPANY.getKey())){ |
| | | //éä¼ä¸ç¨æ·ä¸è½æä½ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED); |
| | | } |
| | | if(param.getCategoryId() == null |
| | | || param.getType() == null |
| | | || param.getRate() == null |
| | | || (Constants.equalsInteger(param.getType(), Constants.ONE) |
| | | && (param.getGoodsParamList() == null |
| | | || param.getGoodsParamList().size()==0))){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | Goods goods = new Goods(); |
| | | |
| | | if(goodsMapper.selectCount(new QueryWrapper<Goods>().eq("ISDELETED",Constants.ZERO).eq("name",goods.getName()))>0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ã"+goods.getName()+"ãå·²åå¨"); |
| | | } |
| | | goods.setStatus(Constants.ZERO); |
| | | goods.setCreateDate(new Date()); |
| | | goods.setCreator(user.getId()); |
| | | goods.setIsdeleted(Constants.ZERO); |
| | | //å¤çæ¼é³é®é¢ |
| | | goods.setPinyin(PinYinUtil.getFullSpell(goods.getName())); |
| | | goods.setShortPinyin(PinYinUtil.getFirstSpell(goods.getName())); |
| | | goodsMapper.insert(goods); |
| | | |
| | | List<Multifile> multifileList = goods.getMultifileList(); |
| | | if(!Objects.isNull(multifileList)&&multifileList.size()>Constants.ZERO){ |
| | | for (int i = 0; i < multifileList.size(); i++) { |
| | | Multifile multifile = multifileList.get(i); |
| | | multifile.setCreator(user.getId()); |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setSortnum(i+Constants.ONE); |
| | | multifile.setObjId(goods.getId()); |
| | | multifile.setType(Constants.ZERO); |
| | | multifile.setObjType(Constants.ZERO); |
| | | multifileMapper.insert(multifile); |
| | | } |
| | | } |
| | | List<GoodsParam> goodsParamList = goods.getGoodsParamList(); |
| | | if(!Objects.isNull(goodsParamList)&&goodsParamList.size()>0){ |
| | | for (int i = 0; i < goodsParamList.size(); i++) { |
| | | GoodsParam goodsParam = goodsParamList.get(i); |
| | | goodsParam.setCreator(user.getId()); |
| | | goodsParam.setCreateDate(new Date()); |
| | | goodsParam.setIsdeleted(Constants.ZERO); |
| | | goodsParam.setSortnum(i+Constants.ONE); |
| | | goodsParam.setStatus(Constants.ZERO); |
| | | goodsParam.setGoodsId(goods.getId()); |
| | | goodsParamMapper.insert(goodsParam); |
| | | } |
| | | } |
| | | |
| | | return goods.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.CateParamSelectMapper; |
| | | import com.doumee.dao.business.model.CateParamSelect; |
| | | import com.doumee.service.CateParamSelectService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åç±»åæ°çé项信æ¯è¡¨Serviceå®ç° |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/09/11 14:45 |
| | | */ |
| | | @Service |
| | | public class CateParamSelectServiceImpl implements CateParamSelectService { |
| | | |
| | | @Autowired |
| | | private CateParamSelectMapper cateParamSelectMapper; |
| | | |
| | | @Override |
| | | public Integer create(CateParamSelect cateParamSelect) { |
| | | cateParamSelectMapper.insert(cateParamSelect); |
| | | return cateParamSelect.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | | cateParamSelectMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(CateParamSelect cateParamSelect) { |
| | | UpdateWrapper<CateParamSelect> deleteWrapper = new UpdateWrapper<>(cateParamSelect); |
| | | cateParamSelectMapper.delete(deleteWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByIdInBatch(List<Integer> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | cateParamSelectMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public void updateById(CateParamSelect cateParamSelect) { |
| | | cateParamSelectMapper.updateById(cateParamSelect); |
| | | } |
| | | |
| | | @Override |
| | | public void updateByIdInBatch(List<CateParamSelect> cateParamSelects) { |
| | | if (CollectionUtils.isEmpty(cateParamSelects)) { |
| | | return; |
| | | } |
| | | for (CateParamSelect cateParamSelect: cateParamSelects) { |
| | | this.updateById(cateParamSelect); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public CateParamSelect findById(Integer id) { |
| | | return cateParamSelectMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public CateParamSelect findOne(CateParamSelect cateParamSelect) { |
| | | QueryWrapper<CateParamSelect> wrapper = new QueryWrapper<>(cateParamSelect); |
| | | return cateParamSelectMapper.selectOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<CateParamSelect> findList(CateParamSelect cateParamSelect) { |
| | | QueryWrapper<CateParamSelect> wrapper = new QueryWrapper<>(cateParamSelect); |
| | | return cateParamSelectMapper.selectList(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public PageData<CateParamSelect> findPage(PageWrap<CateParamSelect> pageWrap) { |
| | | IPage<CateParamSelect> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<CateParamSelect> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(CateParamSelect::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(CateParamSelect::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(CateParamSelect::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(CateParamSelect::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(CateParamSelect::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(CateParamSelect::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(CateParamSelect::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(CateParamSelect::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getRemark() != null) { |
| | | queryWrapper.lambda().eq(CateParamSelect::getRemark, pageWrap.getModel().getRemark()); |
| | | } |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().eq(CateParamSelect::getName, pageWrap.getModel().getName()); |
| | | } |
| | | if (pageWrap.getModel().getParamId() != null) { |
| | | queryWrapper.lambda().eq(CateParamSelect::getParamId, pageWrap.getModel().getParamId()); |
| | | } |
| | | if (pageWrap.getModel().getCategoryId() != null) { |
| | | queryWrapper.lambda().eq(CateParamSelect::getCategoryId, pageWrap.getModel().getCategoryId()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(CateParamSelect::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getSortnum() != null) { |
| | | queryWrapper.lambda().eq(CateParamSelect::getSortnum, pageWrap.getModel().getSortnum()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(cateParamSelectMapper.selectPage(page, queryWrapper)); |
| | | } |
| | | |
| | | @Override |
| | | public long count(CateParamSelect cateParamSelect) { |
| | | QueryWrapper<CateParamSelect> wrapper = new QueryWrapper<>(cateParamSelect); |
| | | return cateParamSelectMapper.selectCount(wrapper); |
| | | } |
| | | } |