结对作业03

bean

package com.cxk.baseframe.config.common.entity.systemmanage.system;

import java.math.BigDecimal;

import com.cxk.baseframe.config.common.annotation.Excel;
import com.cxk.baseframe.config.common.entity.common.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
 * 买票预览表对象 a_beijingsubway
 *
 * @author cxk
 * @date 2024-04-14
 */
public class ABeijingsubway extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键id */
    private Long id;

    /** 起始站 */
    @Excel(name = "起始站")
    private String startStation;

    /** 终点站 */
    @Excel(name = "终点站")
    private String endStation;

    /** 途径站 */
    @Excel(name = "途径站")
    private String intermediateStations;

    /** 起始站的线 */
    @Excel(name = "起始站的线")
    private String startStationLine;

    /** 终点站的线 */
    @Excel(name = "终点站的线")
    private String endStationLine;

    /** 途径站点 */
    @Excel(name = "途径站点")
    private String distNumber;

    /** 票价 */
    @Excel(name = "票价")
    private BigDecimal price;

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId()
    {
        return id;
    }
    public void setStartStation(String startStation)
    {
        this.startStation = startStation;
    }

    public String getStartStation()
    {
        return startStation;
    }
    public void setEndStation(String endStation)
    {
        this.endStation = endStation;
    }

    public String getEndStation()
    {
        return endStation;
    }
    public void setIntermediateStations(String intermediateStations)
    {
        this.intermediateStations = intermediateStations;
    }

    public String getIntermediateStations()
    {
        return intermediateStations;
    }
    public void setStartStationLine(String startStationLine)
    {
        this.startStationLine = startStationLine;
    }

    public String getStartStationLine()
    {
        return startStationLine;
    }
    public void setEndStationLine(String endStationLine)
    {
        this.endStationLine = endStationLine;
    }

    public String getEndStationLine()
    {
        return endStationLine;
    }
    public void setDistNumber(String distNumber)
    {
        this.distNumber = distNumber;
    }

    public String getDistNumber()
    {
        return distNumber;
    }
    public void setPrice(BigDecimal price)
    {
        this.price = price;
    }

    public BigDecimal getPrice()
    {
        return price;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("startStation", getStartStation())
            .append("endStation", getEndStation())
            .append("intermediateStations", getIntermediateStations())
            .append("startStationLine", getStartStationLine())
            .append("endStationLine", getEndStationLine())
            .append("distNumber", getDistNumber())
            .append("price", getPrice())
            .toString();
    }
}

controller

package com.cxk.baseframe.project.systemmanage.controller;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.annotation.Resource;

import com.cxk.baseframe.config.common.annotation.Log;
import com.cxk.baseframe.config.common.entity.common.domain.AjaxResult;
import com.cxk.baseframe.config.common.entity.common.domain.page.TableDataInfo;
import com.cxk.baseframe.config.common.entity.systemmanage.system.ABeijingsubway;
import com.cxk.baseframe.config.common.enums.BusinessType;
import com.cxk.baseframe.config.common.response.BaseController;
import com.cxk.baseframe.config.common.utils.MapUtil;
import com.cxk.baseframe.config.common.utils.poi.ExcelUtil;
import com.cxk.baseframe.project.systemmanage.service.IABeijingsubwayService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * 买票预览表Controller
 *
 * @author cxk
 * @date 2024-04-14
 */
@Api(tags={"买票预览表管理"})
@RestController
@RequestMapping("/system-manage-service/system/beijingsubway")
public class ABeijingsubwayController extends BaseController
{
    @Resource
    private IABeijingsubwayService aBeijingsubwayService;

    /**
     * 查询买票预览表列表
     */
    @ApiOperation(value="查询买票预览表列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "aBeijingsubway", value = "买票预览表实体", dataType = "ABeijingsubway", required = false),
            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "Integer", defaultValue = "1", required = false),
            @ApiImplicitParam(name = "pageSize", value = "每页大小", dataType = "Integer", defaultValue = "10", required = false)
    })
    @GetMapping("/list")
    public TableDataInfo list(ABeijingsubway aBeijingsubway)
    {
        startPage();
        List<ABeijingsubway> list = aBeijingsubwayService.selectABeijingsubwayList(aBeijingsubway);
        return getDataTable(list);
    }

    /**
     * 导出买票预览表列表
     */
    @ApiOperation(value="导出买票预览表列表")
    @ApiImplicitParam(name = "aBeijingsubway", value = "买票预览表实体", dataType = "ABeijingsubway", required = false)
    @Log(title = "买票预览表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ABeijingsubway aBeijingsubway)
    {
        List<ABeijingsubway> list = aBeijingsubwayService.selectABeijingsubwayList(aBeijingsubway);
        ExcelUtil<ABeijingsubway> util = new ExcelUtil<ABeijingsubway>(ABeijingsubway.class);
        util.exportExcel(response, list, "买票预览表数据");
    }

    /**
     * 获取买票预览表详细信息
     */
    @ApiOperation(value="获取买票预览表详细信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "买票预览表Id", dataType = "Long", paramType = "query", required = true)
    })
    @GetMapping(value = "/getInfo")
    public AjaxResult getInfo(@RequestParam Long id)
    {
        return success(aBeijingsubwayService.selectABeijingsubwayById(id));
    }

    /**
     * 新增买票预览表
     */
    @ApiOperation(value="新增买票预览表")
    @ApiImplicitParam(name = "aBeijingsubway", value = "买票预览表实体", dataType = "ABeijingsubway", required = true)
    @Log(title = "买票预览表", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody ABeijingsubway aBeijingsubway)
    {
        return toAjax(aBeijingsubwayService.insertABeijingsubway(aBeijingsubway));
    }

    /**
     * 修改买票预览表
     */
    @ApiOperation(value="修改买票预览表")
    @ApiImplicitParam(name = "aBeijingsubway", value = "买票预览表实体", dataType = "ABeijingsubway", required = true)
    @Log(title = "买票预览表", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody ABeijingsubway aBeijingsubway)
    {
        return toAjax(aBeijingsubwayService.updateABeijingsubway(aBeijingsubway));
    }

    /**
     * 删除买票预览表
     */
    @ApiOperation(value="删除买票预览表")
    @ApiImplicitParam(name = "ids", value = "买票预览表数组", dataType = "Long[]", required = true)
    @Log(title = "买票预览表", businessType = BusinessType.DELETE)
    @PostMapping("/remove")
    public AjaxResult remove(@RequestParam Long[] ids)
    {
        return toAjax(aBeijingsubwayService.deleteABeijingsubwayByIds(ids));
    }

    /**
     * uniapp端删除买票预览表
     */
    @ApiOperation(value="uniapp端删除买票预览表")
    @ApiImplicitParam(name = "ids", value = "买票预览表id(多个以逗号分隔)", dataType = "String", required = true)
    @Log(title = "买票预览表", businessType = BusinessType.DELETE)
    @PostMapping("/delete")
    public AjaxResult delete(@RequestBody Map<String,String> map)
    {
        if(MapUtil.checkContains(map,"ids")){
            String[] ids = map.get("ids").split(",");
            Long[] idArr = new Long[ids.length];
            for (int i = 0; i < ids.length; i++) {
                    idArr[i] = Long.parseLong(ids[i]);
            }
            return toAjax(aBeijingsubwayService.deleteABeijingsubwayByIds(idArr));
        }
        return AjaxResult.error("请先选择买票预览表!");
    }
}

mapper

package com.cxk.baseframe.project.systemmanage.mapper;

import com.cxk.baseframe.config.common.entity.systemmanage.system.ABeijingsubway;

import java.util.List;

/**
 * 买票预览表Mapper接口
 *
 * @author cxk
 * @date 2024-04-14
 */
public interface ABeijingsubwayMapper
{
    /**
     * 查询买票预览表
     *
     * @param id 买票预览表主键
     * @return 买票预览表
     */
    public ABeijingsubway selectABeijingsubwayById(Long id);

    /**
     * 查询买票预览表列表
     *
     * @param aBeijingsubway 买票预览表
     * @return 买票预览表集合
     */
    public List<ABeijingsubway> selectABeijingsubwayList(ABeijingsubway aBeijingsubway);

    /**
     * 新增买票预览表
     *
     * @param aBeijingsubway 买票预览表
     * @return 结果
     */
    public int insertABeijingsubway(ABeijingsubway aBeijingsubway);

    /**
     * 修改买票预览表
     *
     * @param aBeijingsubway 买票预览表
     * @return 结果
     */
    public int updateABeijingsubway(ABeijingsubway aBeijingsubway);

    /**
     * 删除买票预览表
     *
     * @param id 买票预览表主键
     * @return 结果
     */
    public int deleteABeijingsubwayById(Long id);

    /**
     * 批量删除买票预览表
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteABeijingsubwayByIds(Long[] ids);
}

 

 

service

package com.cxk.baseframe.project.systemmanage.service.Impl;

import java.util.List;
import javax.annotation.Resource;

import com.cxk.baseframe.config.common.entity.systemmanage.system.ABeijingsubway;
import com.cxk.baseframe.project.systemmanage.mapper.ABeijingsubwayMapper;
import com.cxk.baseframe.project.systemmanage.service.IABeijingsubwayService;
import org.springframework.stereotype.Service;

/**
 * 买票预览表Service业务层处理
 *
 * @author cxk
 * @date 2024-04-14
 */
@Service
public class ABeijingsubwayServiceImpl implements IABeijingsubwayService
{
    @Resource
    private ABeijingsubwayMapper aBeijingsubwayMapper;

    /**
     * 查询买票预览表
     *
     * @param id 买票预览表主键
     * @return 买票预览表
     */
    @Override
    public ABeijingsubway selectABeijingsubwayById(Long id)
    {
        return aBeijingsubwayMapper.selectABeijingsubwayById(id);
    }

    /**
     * 查询买票预览表列表
     *
     * @param aBeijingsubway 买票预览表
     * @return 买票预览表
     */
    @Override
    public List<ABeijingsubway> selectABeijingsubwayList(ABeijingsubway aBeijingsubway)
    {
        return aBeijingsubwayMapper.selectABeijingsubwayList(aBeijingsubway);
    }

    /**
     * 新增买票预览表
     *
     * @param aBeijingsubway 买票预览表
     * @return 结果
     */
    @Override
    public int insertABeijingsubway(ABeijingsubway aBeijingsubway)
    {
        return aBeijingsubwayMapper.insertABeijingsubway(aBeijingsubway);
    }

    /**
     * 修改买票预览表
     *
     * @param aBeijingsubway 买票预览表
     * @return 结果
     */
    @Override
    public int updateABeijingsubway(ABeijingsubway aBeijingsubway)
    {
        return aBeijingsubwayMapper.updateABeijingsubway(aBeijingsubway);
    }

    /**
     * 批量删除买票预览表
     *
     * @param ids 需要删除的买票预览表主键
     * @return 结果
     */
    @Override
    public int deleteABeijingsubwayByIds(Long[] ids)
    {
        return aBeijingsubwayMapper.deleteABeijingsubwayByIds(ids);
    }

    /**
     * 删除买票预览表信息
     *
     * @param id 买票预览表主键
     * @return 结果
     */
    @Override
    public int deleteABeijingsubwayById(Long id)
    {
        return aBeijingsubwayMapper.deleteABeijingsubwayById(id);
    }
}

 

posted @ 2024-04-14 16:19  艾鑫4646  阅读(4)  评论(0编辑  收藏  举报