leomonM
2025-09-06 9b7468e02289919b19c467efdde88474622da48f
oying-system/src/main/java/com/oying/modules/message/rest/MesCustomerCommentMsgController.java
@@ -1,86 +1,79 @@
package com.oying.modules.message.rest;
import com.oying.annotation.Log;
import com.oying.modules.message.domain.MesCustomerCommentMsg;
import com.oying.modules.message.domain.dto.MesShopMsgRespDTO;
import com.oying.modules.message.domain.myDto.MesCustomerCommentMsgDTO;
import com.oying.modules.message.service.MesCustomerCommentMsgService;
import com.oying.modules.message.domain.dto.MesCustomerCommentMsgQueryCriteria;
import com.oying.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.oying.utils.PageResult;
/**
* @author 李萌
* @date 2025-07-25
**/
 * @author 李萌
 * @date 2025-07-25
 **/
@RestController
@RequiredArgsConstructor
@Api(tags = "消息")
@Api(tags = "消息中心:留言")
@RequestMapping("/api/mesCustomerCommentMsg")
public class MesCustomerCommentMsgController {
    private final MesCustomerCommentMsgService mesCustomerCommentMsgService;
//
//    @ApiOperation("导出数据")
//    @GetMapping(value = "/download")
//    @PreAuthorize("@el.check('mesCustomerCommentMsg:list')")
//    public void exportMesCustomerCommentMsg(HttpServletResponse response, MesCustomerCommentMsgQueryCriteria criteria) throws IOException {
//        mesCustomerCommentMsgService.download(mesCustomerCommentMsgService.queryAll(criteria), response);
//    }
//
//    @GetMapping
//    @ApiOperation("查询消息")
//    @PreAuthorize("@el.check('mesCustomerCommentMsg:list')")
//    public ResponseEntity<PageResult<MesCustomerCommentMsg>> queryMesCustomerCommentMsg(MesCustomerCommentMsgQueryCriteria criteria) {
//        Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
//        return new ResponseEntity<>(mesCustomerCommentMsgService.queryAll(criteria, page), HttpStatus.OK);
//    }
//
//    @PostMapping
//    @Log("新增消息")
//    @ApiOperation("新增消息")
//    @PreAuthorize("@el.check('mesCustomerCommentMsg:add')")
//    public ResponseEntity<Object> createMesCustomerCommentMsg(@Validated @RequestBody MesCustomerCommentMsg resources) {
//        mesCustomerCommentMsgService.create(resources);
//        return new ResponseEntity<>(HttpStatus.CREATED);
//    }
//
//    @PutMapping
//    @Log("修改消息")
//    @ApiOperation("修改消息")
//    @PreAuthorize("@el.check('mesCustomerCommentMsg:edit')")
//    public ResponseEntity<Object> updateMesCustomerCommentMsg(@Validated @RequestBody MesCustomerCommentMsg resources) {
//        mesCustomerCommentMsgService.update(resources);
//        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
//    }
//
//    @DeleteMapping
//    @Log("删除消息")
//    @ApiOperation("删除消息")
//    @PreAuthorize("@el.check('mesCustomerCommentMsg:del')")
//    public ResponseEntity<Object> deleteMesCustomerCommentMsg(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) {
//        mesCustomerCommentMsgService.deleteAll(ids);
//        return new ResponseEntity<>(HttpStatus.OK);
//    }
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('mesCustomerCommentMsg:list')")
    public void exportMesCustomerCommentMsg(HttpServletResponse response, MesCustomerCommentMsgQueryCriteria criteria) throws IOException {
        mesCustomerCommentMsgService.download(mesCustomerCommentMsgService.queryAll(criteria), response);
    }
    @GetMapping
    @ApiOperation("查询消息")
    @PreAuthorize("@el.check('mesCustomerCommentMsg:list')")
    public ResponseEntity<PageResult<MesCustomerCommentMsg>> queryMesCustomerCommentMsg(MesCustomerCommentMsgQueryCriteria criteria){
        Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
        return new ResponseEntity<>(mesCustomerCommentMsgService.queryAll(criteria,page),HttpStatus.OK);
    }
    @PostMapping
    @Log("新增消息")
    @ApiOperation("新增消息")
    @PreAuthorize("@el.check('mesCustomerCommentMsg:add')")
    public ResponseEntity<Object> createMesCustomerCommentMsg(@Validated @RequestBody MesCustomerCommentMsg resources){
        mesCustomerCommentMsgService.create(resources);
        return new ResponseEntity<>(HttpStatus.CREATED);
    }
    @PutMapping
    @Log("修改消息")
    @ApiOperation("修改消息")
    @PreAuthorize("@el.check('mesCustomerCommentMsg:edit')")
    public ResponseEntity<Object> updateMesCustomerCommentMsg(@Validated @RequestBody MesCustomerCommentMsg resources){
        mesCustomerCommentMsgService.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @DeleteMapping
    @Log("删除消息")
    @ApiOperation("删除消息")
    @PreAuthorize("@el.check('mesCustomerCommentMsg:del')")
    public ResponseEntity<Object> deleteMesCustomerCommentMsg(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) {
        mesCustomerCommentMsgService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
    /* 5. 用店铺id 查询分页顾客留言 */
    /* 5. 用店铺id 查询分页顾客留言    订单一一顾客*/
    @GetMapping("/customerComment")
    @ApiOperation("list查询顾客留言")
    @ApiOperation("店铺号list查询顾客留言")
    public R<List<MesCustomerCommentMsgDTO>> customerComment(
            @RequestParam Long shopId) {
        try {
            List<MesCustomerCommentMsgDTO> res=mesCustomerCommentMsgService.listCustomerComment(shopId);
            List<MesCustomerCommentMsgDTO> res = mesCustomerCommentMsgService.listCustomerComment(shopId);
            return R.success(res);
        } catch (Exception e) {
            return R.fail(e.getMessage());