结对作业01

代码量:500

博客:1

这个是Bean文件

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_stations
 *
 * @author cxk
 * @date 2024-04-14
 */
public class AStations extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 站点ID */
    @Excel(name = "站点ID")
    private Long id;

    /** 线路编号 */
    @Excel(name = "线路编号")
    private String lineno;

    /** 站点名称 */
    @Excel(name = "站点名称")
    private String name;

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

    public Long getId()
    {
        return id;
    }
    public void setLineno(String lineno)
    {
        this.lineno = lineno;
    }

    public String getLineno()
    {
        return lineno;
    }
    public void setName(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return name;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("lineno", getLineno())
            .append("name", getName())
            .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.AStations;
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.IAStationsService;
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/stations")
public class AStationsController extends BaseController
{
    @Resource
    private IAStationsService aStationsService;

    /**
     * 查询地铁线路和站点列表
     */
    @ApiOperation(value="查询地铁线路和站点列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "aStations", value = "地铁线路和站点实体", dataType = "AStations", 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(AStations aStations)
    {
        startPage();
        List<AStations> list = aStationsService.selectAStationsList(aStations);
        return getDataTable(list);
    }

    /**
     * 导出地铁线路和站点列表
     */
    @ApiOperation(value="导出地铁线路和站点列表")
    @ApiImplicitParam(name = "aStations", value = "地铁线路和站点实体", dataType = "AStations", required = false)
    @Log(title = "地铁线路和站点", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AStations aStations)
    {
        List<AStations> list = aStationsService.selectAStationsList(aStations);
        ExcelUtil<AStations> util = new ExcelUtil<AStations>(AStations.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(aStationsService.selectAStationsById(id));
    }

    /**
     * 新增地铁线路和站点
     */
    @ApiOperation(value="新增地铁线路和站点")
    @ApiImplicitParam(name = "aStations", value = "地铁线路和站点实体", dataType = "AStations", required = true)
    @Log(title = "地铁线路和站点", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody AStations aStations)
    {
        return toAjax(aStationsService.insertAStations(aStations));
    }

    /**
     * 修改地铁线路和站点
     */
    @ApiOperation(value="修改地铁线路和站点")
    @ApiImplicitParam(name = "aStations", value = "地铁线路和站点实体", dataType = "AStations", required = true)
    @Log(title = "地铁线路和站点", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody AStations aStations)
    {
        return toAjax(aStationsService.updateAStations(aStations));
    }

    /**
     * 删除地铁线路和站点
     */
    @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(aStationsService.deleteAStationsByIds(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(aStationsService.deleteAStationsByIds(idArr));
        }
        return AjaxResult.error("请先选择地铁线路和站点!");
    }
}
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);
    }
}

mapper层

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

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

import java.util.List;

/**
 * 地铁线路和站点Mapper接口
 *
 * @author cxk
 * @date 2024-04-14
 */
public interface AStationsMapper
{
    /**
     * 查询地铁线路和站点
     *
     * @param id 地铁线路和站点主键
     * @return 地铁线路和站点
     */
    public AStations selectAStationsById(Long id);

    /**
     * 查询地铁线路和站点列表
     *
     * @param aStations 地铁线路和站点
     * @return 地铁线路和站点集合
     */
    public List<AStations> selectAStationsList(AStations aStations);

    /**
     * 新增地铁线路和站点
     *
     * @param aStations 地铁线路和站点
     * @return 结果
     */
    public int insertAStations(AStations aStations);

    /**
     * 修改地铁线路和站点
     *
     * @param aStations 地铁线路和站点
     * @return 结果
     */
    public int updateAStations(AStations aStations);

    /**
     * 删除地铁线路和站点
     *
     * @param id 地铁线路和站点主键
     * @return 结果
     */
    public int deleteAStationsById(Long id);

    /**
     * 批量删除地铁线路和站点
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAStationsByIds(Long[] ids);
}
posted @ 2024-04-14 16:14  艾鑫4646  阅读(7)  评论(0编辑  收藏  举报