Commit 89fbe881 authored by 耿迪迪's avatar 耿迪迪

生产计划

parent ba924539
package com.zehong.web.controller.track;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.track.TProductPlan;
import com.zehong.system.service.track.ITProductPlanService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 生产计划Controller
*
* @author zehong
* @date 2024-08-24
*/
@RestController
@RequestMapping("/track/plan")
public class TProductPlanController extends BaseController
{
@Autowired
private ITProductPlanService tProductPlanService;
/**
* 查询生产计划列表
*/
// @PreAuthorize("@ss.hasPermi('system:plan:list')")
@GetMapping("/list")
public TableDataInfo list(TProductPlan tProductPlan)
{
startPage();
List<TProductPlan> list = tProductPlanService.selectTProductPlanList(tProductPlan);
return getDataTable(list);
}
/**
* 导出生产计划列表
*/
//@PreAuthorize("@ss.hasPermi('system:plan:export')")
@Log(title = "生产计划", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TProductPlan tProductPlan)
{
List<TProductPlan> list = tProductPlanService.selectTProductPlanList(tProductPlan);
ExcelUtil<TProductPlan> util = new ExcelUtil<TProductPlan>(TProductPlan.class);
return util.exportExcel(list, "生产计划数据");
}
/**
* 获取生产计划详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:plan:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tProductPlanService.selectTProductPlanById(id));
}
/**
* 新增生产计划
*/
//@PreAuthorize("@ss.hasPermi('system:plan:add')")
@Log(title = "生产计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TProductPlan tProductPlan)
{
return toAjax(tProductPlanService.insertTProductPlan(tProductPlan));
}
/**
* 修改生产计划
*/
//@PreAuthorize("@ss.hasPermi('system:plan:edit')")
@Log(title = "生产计划", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TProductPlan tProductPlan)
{
return toAjax(tProductPlanService.updateTProductPlan(tProductPlan));
}
/**
* 删除生产计划
*/
//@PreAuthorize("@ss.hasPermi('system:plan:remove')")
@Log(title = "生产计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tProductPlanService.deleteTProductPlanByIds(ids));
}
}
package com.zehong.system.domain.track;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 生产计划对象 t_product_plan
*
* @author zehong
* @date 2024-08-24
*/
public class TProductPlan extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 计划名称 */
@Excel(name = "计划名称")
private String title;
/** 计划编号 */
@Excel(name = "计划编号")
private String planNo;
/** 计划描述 */
@Excel(name = "计划描述")
private String content;
/** 生产总数 */
@Excel(name = "生产总数")
private Long total;
/** 计划状态(数据字典) */
@Excel(name = "计划状态", dictType = "product_plan_status")
private String status;
/** 创建人 */
private Long createId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setPlanNo(String planNo)
{
this.planNo = planNo;
}
public String getPlanNo()
{
return planNo;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setTotal(Long total)
{
this.total = total;
}
public Long getTotal()
{
return total;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setCreateId(Long createId)
{
this.createId = createId;
}
public Long getCreateId()
{
return createId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("title", getTitle())
.append("planNo", getPlanNo())
.append("content", getContent())
.append("total", getTotal())
.append("status", getStatus())
.append("createTime", getCreateTime())
.append("createId", getCreateId())
.toString();
}
}
package com.zehong.system.mapper.track;
import java.util.List;
import com.zehong.system.domain.track.TProductPlan;
/**
* 生产计划Mapper接口
*
* @author zehong
* @date 2024-08-24
*/
public interface TProductPlanMapper
{
/**
* 查询生产计划
*
* @param id 生产计划ID
* @return 生产计划
*/
public TProductPlan selectTProductPlanById(Long id);
/**
* 查询生产计划列表
*
* @param tProductPlan 生产计划
* @return 生产计划集合
*/
public List<TProductPlan> selectTProductPlanList(TProductPlan tProductPlan);
/**
* 新增生产计划
*
* @param tProductPlan 生产计划
* @return 结果
*/
public int insertTProductPlan(TProductPlan tProductPlan);
/**
* 修改生产计划
*
* @param tProductPlan 生产计划
* @return 结果
*/
public int updateTProductPlan(TProductPlan tProductPlan);
/**
* 删除生产计划
*
* @param id 生产计划ID
* @return 结果
*/
public int deleteTProductPlanById(Long id);
/**
* 批量删除生产计划
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTProductPlanByIds(Long[] ids);
}
package com.zehong.system.service.impl.track;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.track.TProductPlanMapper;
import com.zehong.system.domain.track.TProductPlan;
import com.zehong.system.service.track.ITProductPlanService;
/**
* 生产计划Service业务层处理
*
* @author zehong
* @date 2024-08-24
*/
@Service
public class TProductPlanServiceImpl implements ITProductPlanService
{
@Autowired
private TProductPlanMapper tProductPlanMapper;
/**
* 查询生产计划
*
* @param id 生产计划ID
* @return 生产计划
*/
@Override
public TProductPlan selectTProductPlanById(Long id)
{
return tProductPlanMapper.selectTProductPlanById(id);
}
/**
* 查询生产计划列表
*
* @param tProductPlan 生产计划
* @return 生产计划
*/
@Override
public List<TProductPlan> selectTProductPlanList(TProductPlan tProductPlan)
{
return tProductPlanMapper.selectTProductPlanList(tProductPlan);
}
/**
* 新增生产计划
*
* @param tProductPlan 生产计划
* @return 结果
*/
@Override
public int insertTProductPlan(TProductPlan tProductPlan)
{
tProductPlan.setCreateTime(DateUtils.getNowDate());
tProductPlan.setCreateId(SecurityUtils.getLoginUser().getUser().getUserId());
return tProductPlanMapper.insertTProductPlan(tProductPlan);
}
/**
* 修改生产计划
*
* @param tProductPlan 生产计划
* @return 结果
*/
@Override
public int updateTProductPlan(TProductPlan tProductPlan)
{
return tProductPlanMapper.updateTProductPlan(tProductPlan);
}
/**
* 批量删除生产计划
*
* @param ids 需要删除的生产计划ID
* @return 结果
*/
@Override
public int deleteTProductPlanByIds(Long[] ids)
{
return tProductPlanMapper.deleteTProductPlanByIds(ids);
}
/**
* 删除生产计划信息
*
* @param id 生产计划ID
* @return 结果
*/
@Override
public int deleteTProductPlanById(Long id)
{
return tProductPlanMapper.deleteTProductPlanById(id);
}
}
package com.zehong.system.service.track;
import java.util.List;
import com.zehong.system.domain.track.TProductPlan;
/**
* 生产计划Service接口
*
* @author zehong
* @date 2024-08-24
*/
public interface ITProductPlanService
{
/**
* 查询生产计划
*
* @param id 生产计划ID
* @return 生产计划
*/
public TProductPlan selectTProductPlanById(Long id);
/**
* 查询生产计划列表
*
* @param tProductPlan 生产计划
* @return 生产计划集合
*/
public List<TProductPlan> selectTProductPlanList(TProductPlan tProductPlan);
/**
* 新增生产计划
*
* @param tProductPlan 生产计划
* @return 结果
*/
public int insertTProductPlan(TProductPlan tProductPlan);
/**
* 修改生产计划
*
* @param tProductPlan 生产计划
* @return 结果
*/
public int updateTProductPlan(TProductPlan tProductPlan);
/**
* 批量删除生产计划
*
* @param ids 需要删除的生产计划ID
* @return 结果
*/
public int deleteTProductPlanByIds(Long[] ids);
/**
* 删除生产计划信息
*
* @param id 生产计划ID
* @return 结果
*/
public int deleteTProductPlanById(Long id);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.track.TProductPlanMapper">
<resultMap type="TProductPlan" id="TProductPlanResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="planNo" column="plan_no" />
<result property="content" column="content" />
<result property="total" column="total" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
<result property="createId" column="create_id" />
</resultMap>
<sql id="selectTProductPlanVo">
select id, title, plan_no, content, total, status, create_time, create_id, <include refid="Common.createBy"/> from t_product_plan
</sql>
<select id="selectTProductPlanList" parameterType="TProductPlan" resultMap="TProductPlanResult">
<include refid="selectTProductPlanVo"/>
<where>
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="planNo != null and planNo != ''"> and plan_no like concat('%', #{planNo}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
order by create_time desc
</select>
<select id="selectTProductPlanById" parameterType="Long" resultMap="TProductPlanResult">
<include refid="selectTProductPlanVo"/>
where id = #{id}
</select>
<insert id="insertTProductPlan" parameterType="TProductPlan" useGeneratedKeys="true" keyProperty="id">
insert into t_product_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">title,</if>
<if test="planNo != null">plan_no,</if>
<if test="content != null">content,</if>
<if test="total != null">total,</if>
<if test="status != null">status,</if>
<if test="createTime != null">create_time,</if>
<if test="createId != null">create_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">#{title},</if>
<if test="planNo != null">#{planNo},</if>
<if test="content != null">#{content},</if>
<if test="total != null">#{total},</if>
<if test="status != null">#{status},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createId != null">#{createId},</if>
</trim>
</insert>
<update id="updateTProductPlan" parameterType="TProductPlan">
update t_product_plan
<trim prefix="SET" suffixOverrides=",">
<if test="title != null">title = #{title},</if>
<if test="planNo != null">plan_no = #{planNo},</if>
<if test="content != null">content = #{content},</if>
<if test="total != null">total = #{total},</if>
<if test="status != null">status = #{status},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createId != null">create_id = #{createId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTProductPlanById" parameterType="Long">
delete from t_product_plan where id = #{id}
</delete>
<delete id="deleteTProductPlanByIds" parameterType="String">
delete from t_product_plan where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询生产计划列表
export function listPlan(query) {
return request({
url: '/track/plan/list',
method: 'get',
params: query
})
}
// 查询生产计划详细
export function getPlan(id) {
return request({
url: '/track/plan/' + id,
method: 'get'
})
}
// 新增生产计划
export function addPlan(data) {
return request({
url: '/track/plan',
method: 'post',
data: data
})
}
// 修改生产计划
export function updatePlan(data) {
return request({
url: '/track/plan',
method: 'put',
data: data
})
}
// 删除生产计划
export function delPlan(id) {
return request({
url: '/track/plan/' + id,
method: 'delete'
})
}
// 导出生产计划
export function exportPlan(query) {
return request({
url: '/track/plan/export',
method: 'get',
params: query
})
}
<template>
<el-dialog title="详情" :visible.sync="detailOpen" width="800px" append-to-body destroy-on-close :close-on-click-modal="false">
<el-form label-width="90px">
<el-row class="el-row-table">
<el-col :span="12">
<el-form-item label="计划名称">
<span v-if="detailInfo.title">{{ detailInfo.title }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计划编号">
<span v-if="detailInfo.planNo">{{ detailInfo.planNo }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生产总数">
<span v-if="detailInfo.total">{{ detailInfo.total }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="创建时间">
<span v-if="detailInfo.createTime">{{ detailInfo.createTime }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="创建人">
<span v-if="detailInfo.createBy">{{ detailInfo.createBy }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="计划描述">
<span v-if="detailInfo.content">{{ detailInfo.content }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-dialog>
</template>
<script>
import { getPlan } from "@/api/track/plan";
export default {
name: "detail-info",
data(){
return{
detailOpen: false,
detailInfo: {}
}
},
methods:{
getDetailInfo(id){
getPlan(id).then(res =>{
if(res.code == 200){
this.detailInfo = res.data;
this.detailOpen = true;
}
})
}
}
}
</script>
<style scoped>
</style>
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment