kongzy
2024-09-23 d015cc0b48ca51a2b93b6c60c91dc352a104b1e7
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/controller/RewardPunishmentStandardController.java
@@ -1,29 +1,24 @@
package com.gkhy.safePlatform.targetDuty.controller;
import java.util.Date;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.targetDuty.entity.RewardPunishmentStandard;
import com.gkhy.safePlatform.targetDuty.entity.TargetMng;
import com.gkhy.safePlatform.targetDuty.model.dto.req.RewardPunishmentStandardQueryCriteria;
import com.gkhy.safePlatform.targetDuty.service.RewardPunishmentStandardService;
import com.gkhy.safePlatform.targetDuty.service.baseService.RewardPunishmentStandardBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.utils.PageUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.targetDuty.model.dto.req.RewardPunishmentStandardQueryCriteria;
import org.springframework.web.multipart.MultipartFile;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Serializable;
import java.util.List;
/**
 * (RewardPunishmentStandard)表控制层
@@ -39,6 +34,13 @@
     */
    @Resource
    private RewardPunishmentStandardService rewardPunishmentStandardService;
    @Resource
    private RewardPunishmentStandardBaseService rewardPunishmentStandardBaseService;
    @Autowired
    public HttpServletRequest request;
    @Autowired
    public HttpServletResponse response;
    /**
     * 分页查询所有数据
@@ -48,7 +50,6 @@
     */
    @PostMapping(value = "/page/list")
    public ResultVO selectAll(@RequestBody PageQuery<RewardPunishmentStandardQueryCriteria> pageQuery){
      PageUtils.checkCheck(pageQuery.getPageIndex(), pageQuery.getPageSize());
      return this.rewardPunishmentStandardService.queryAll(pageQuery);
    }
   
@@ -61,7 +62,7 @@
     */
    @GetMapping(value = "/selectOne/{id}")
    public ResultVO selectOne(@PathVariable Serializable id) {
        return new ResultVO<>(ResultCodes.OK,this.rewardPunishmentStandardService.getById(id));
        return new ResultVO<>(ResultCodes.OK,this.rewardPunishmentStandardBaseService.getById(id));
    }
   /**
@@ -79,9 +80,9 @@
            return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL,"缺少qName");
        }
        if (rewardPunishmentStandard.getId() == null) {
            return new ResultVO<>(ResultCodes.OK,rewardPunishmentStandardService.save(rewardPunishmentStandard));
            return new ResultVO<>(ResultCodes.OK,rewardPunishmentStandardBaseService.save(rewardPunishmentStandard));
        } else {
            rewardPunishmentStandardService.update(rewardPunishmentStandard,new UpdateWrapper<RewardPunishmentStandard>().eq("id",rewardPunishmentStandard.getId()));
            rewardPunishmentStandardBaseService.update(rewardPunishmentStandard,new UpdateWrapper<RewardPunishmentStandard>().eq("id",rewardPunishmentStandard.getId()));
            return new ResultVO<>(ResultCodes.OK);
        }
    }
@@ -92,15 +93,47 @@
     * @param ids 主键结合
     * @return 删除结果
     */
    @GetMapping(value = "/delete")
    public ResultVO delete(String ids) {
   List<String> idList = Arrays.stream(ids.split(","))
                .collect(Collectors.toList());
        this.rewardPunishmentStandardService.removeByIds(idList);
    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    public ResultVO delete(@RequestBody Long[] ids) {
        this.rewardPunishmentStandardService.delete(ids);
        return new ResultVO<>(ResultCodes.OK);
    }
    /**
     * 下载模板
     *
     */
    @GetMapping(value = "/exportTemplate")
    public void exportTemplate() throws IOException {
        rewardPunishmentStandardService.exportTemplate();
    }
    /**
     * 导出一览数据
     *
     */
    @GetMapping(value = "/exportData")
    public void exportData(RewardPunishmentStandardQueryCriteria queryCriteria) throws IOException {
        rewardPunishmentStandardService.exportData(queryCriteria);
    }
    /**
     * 导入数据
     *
     */
    @RequestMapping(value = "/importData")
    public ResultVO importData(MultipartFile file) throws IOException {
        rewardPunishmentStandardService.importData(file);
        return new ResultVO<>(ResultCodes.OK);
    }
    public static void main(String[] args) {
        RewardPunishmentStandard mng = new RewardPunishmentStandard();
        mng.setStandardType(1);