仓库管理
This commit is contained in:
parent
a5ec76ab8a
commit
5ad5888949
|
|
@ -51,6 +51,12 @@ public class BmProject extends BaseEntity implements Serializable {
|
|||
@Min(value = 1, message = "项目类型不能为空")
|
||||
private Integer projectType;
|
||||
|
||||
/**
|
||||
* 项目类型。 1:线路工程;2:变电工程;3:业务工程;4:其他工程
|
||||
*/
|
||||
@ApiModelProperty(value = "工程类型名称")
|
||||
private String projectTypeName;
|
||||
|
||||
/**
|
||||
* i8工程id
|
||||
*/
|
||||
|
|
@ -97,6 +103,12 @@ public class BmProject extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "项目性质")
|
||||
private String nature;
|
||||
|
||||
/**
|
||||
* 项目性质
|
||||
*/
|
||||
@ApiModelProperty(value = "项目性质名称")
|
||||
private String natureName;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
|
|
@ -112,6 +124,12 @@ public class BmProject extends BaseEntity implements Serializable {
|
|||
@Excel(name = "工程状态")
|
||||
private String stats;
|
||||
|
||||
/**
|
||||
* 工程状态
|
||||
*/
|
||||
@ApiModelProperty(value = "工程状态名称")
|
||||
private String statsName;
|
||||
|
||||
/**
|
||||
* 传真
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
package com.bonus.base.api.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* ma_house物资仓库(MaHouse)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-14 09:22:54
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MaHouse implements Serializable {
|
||||
private static final long serialVersionUID = -11758888261312379L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 0不启用,1启用
|
||||
*/
|
||||
private String isActive;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 仓库名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -146,12 +146,12 @@ public class GlobalExceptionHandler
|
|||
|
||||
/**
|
||||
* 处理系统异常,在其他异常拦截均未捕获时进行兜底处理
|
||||
*/
|
||||
*//*
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
public AjaxResult defaultHandleException(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 内部认证异常
|
||||
|
|
|
|||
|
|
@ -34,17 +34,23 @@
|
|||
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, project_type, `name`, num, manager, nature, telphone, phone, fax, address, remark,
|
||||
material_clerk, company_id, `time`,
|
||||
is_active, lon, lat, company, imp_unit, dept_name, pro_id, dept_id, cvo, stats, htzt, is_match
|
||||
bmp.id, bmp.project_type, sda1.dict_label AS projectTypeName, bmp.name, bmp.num, bmp.manager,bmp.nature,
|
||||
sda2.dict_label AS natureName, bmp.telphone, bmp.phone, bmp.fax, bmp.address,
|
||||
bmp.remark, bmp.material_clerk, bmp.company_id, bmp.time,
|
||||
bmp.is_active, bmp.lon, bmp.lat, bmp.company, bmp.imp_unit,
|
||||
bmp.dept_name, bmp.pro_id, bmp.dept_id, bmp.cvo, bmp.stats, sda3.dict_label AS statsName,
|
||||
bmp.htzt, bmp.is_match
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from bm_project
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
from bm_project bmp
|
||||
LEFT JOIN sys_dict_data sda1 ON bmp.project_type = sda1.dict_code
|
||||
LEFT JOIN sys_dict_data sda2 ON bmp.nature = sda2.dict_code
|
||||
LEFT JOIN sys_dict_data sda3 ON bmp.stats = sda3.dict_code
|
||||
where is_active = '1' and id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultMap="BaseResultMap">
|
||||
|
|
@ -52,6 +58,9 @@
|
|||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from bm_project bmp
|
||||
LEFT JOIN sys_dict_data sda1 ON bmp.project_type = sda1.dict_code
|
||||
LEFT JOIN sys_dict_data sda2 ON bmp.nature = sda2.dict_code
|
||||
LEFT JOIN sys_dict_data sda3 ON bmp.stats = sda3.dict_code
|
||||
where is_active = '1'
|
||||
<if test="name != null and name !=''">
|
||||
and bmp.name LIKE CONCAT('%',#{name},'%')
|
||||
|
|
|
|||
|
|
@ -0,0 +1,118 @@
|
|||
package com.bonus.material.controller;
|
||||
|
||||
import com.bonus.base.api.domain.MaHouse;
|
||||
import com.bonus.base.api.domain.MaType;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.material.service.MaHouseService;
|
||||
import com.bonus.material.vo.MaTypeVo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ma_house物资仓库(MaHouse)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-14 09:21:18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/maHouse")
|
||||
public class MaHouseController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private MaHouseService maHouseService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param maHouse 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@ApiOperation(value = "分页查询")
|
||||
@GetMapping("/list")
|
||||
@RequiresPermissions("material:maHouse:query")
|
||||
public TableDataInfo queryByPage(MaHouse maHouse) {
|
||||
startPage();
|
||||
List<MaHouse> list = maHouseService.queryByPage(maHouse);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@ApiOperation(value = "通过主键查询单条数据")
|
||||
@GetMapping("{id}")
|
||||
@RequiresPermissions("material:maHouse:query")
|
||||
public AjaxResult queryById(@PathVariable("id") Integer id) {
|
||||
return success(maHouseService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param maHouse 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@ApiOperation(value = "新增数据")
|
||||
@PostMapping("/add")
|
||||
@RequiresPermissions("material:maHouse:add")
|
||||
public AjaxResult add(@RequestBody MaHouse maHouse) {
|
||||
return maHouseService.insert(maHouse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param maHouse 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@ApiOperation(value = "编辑数据")
|
||||
@PostMapping("/update")
|
||||
@RequiresPermissions("material:maHouse:edit")
|
||||
public AjaxResult edit(@RequestBody MaHouse maHouse) {
|
||||
return maHouseService.update(maHouse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@ApiOperation(value = "删除数据")
|
||||
@DeleteMapping("/{id}")
|
||||
@RequiresPermissions("material:maHouse:remove")
|
||||
public AjaxResult deleteById(@PathVariable("id") Integer id) {
|
||||
return maHouseService.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出仓库列表
|
||||
*/
|
||||
@ApiOperation(value = "导出仓库列表")
|
||||
@RequiresPermissions("material:maHouse:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MaHouse maHouse)
|
||||
{
|
||||
List<MaHouse> list = maHouseService.queryByPage(maHouse);
|
||||
ExcelUtil<MaHouse> util = new ExcelUtil<>(MaHouse.class);
|
||||
util.exportExcel(response, list, "仓库列表数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.bonus.material.mapper;
|
||||
|
||||
import com.bonus.base.api.domain.MaHouse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ma_house物资仓库(MaHouse)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-14 09:24:39
|
||||
*/
|
||||
public interface MaHouseMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id
|
||||
* @return 实例对象
|
||||
*/
|
||||
MaHouse queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param maHouse 查询条件
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<MaHouse> queryAllByLimit(MaHouse maHouse);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param maHouse 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(MaHouse maHouse);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param maHouse 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(MaHouse maHouse);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
/**
|
||||
* 根据名称查询
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
MaHouse queryByName(String name);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.bonus.material.service;
|
||||
|
||||
|
||||
import com.bonus.base.api.domain.MaHouse;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ma_house物资仓库(MaHouse)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-14 09:24:40
|
||||
*/
|
||||
public interface MaHouseService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
MaHouse queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param maHouse 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<MaHouse> queryByPage(MaHouse maHouse);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param maHouse 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult insert(MaHouse maHouse);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param maHouse 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
AjaxResult update(MaHouse maHouse);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id
|
||||
* @return 是否成功
|
||||
*/
|
||||
AjaxResult deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package com.bonus.material.service.impl;
|
||||
|
||||
import com.bonus.base.api.domain.MaHouse;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.mapper.MaHouseMapper;
|
||||
import com.bonus.material.service.MaHouseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ma_house物资仓库(MaHouse)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-14 09:24:40
|
||||
*/
|
||||
@Service("maHouseService")
|
||||
public class MaHouseServiceImpl implements MaHouseService {
|
||||
@Resource
|
||||
private MaHouseMapper maHouseDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public MaHouse queryById(Integer id) {
|
||||
return maHouseDao.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param maHouse 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public List<MaHouse> queryByPage(MaHouse maHouse) {
|
||||
List<MaHouse> maHouses = maHouseDao.queryAllByLimit(maHouse);
|
||||
return maHouses;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param maHouse 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insert(MaHouse maHouse) {
|
||||
//根据名称查询,去重
|
||||
MaHouse house = maHouseDao.queryByName(maHouse.getName());
|
||||
if (house != null) {
|
||||
return AjaxResult.error("仓库名称重复");
|
||||
}
|
||||
int result = maHouseDao.insert(maHouse);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
} else {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param maHouse 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult update(MaHouse maHouse) {
|
||||
//根据名称查询,去重
|
||||
MaHouse house = maHouseDao.queryByName(maHouse.getName());
|
||||
if (house != null && !house.getId().equals(maHouse.getId())) {
|
||||
return AjaxResult.error("仓库名称重复");
|
||||
}
|
||||
int result = maHouseDao.update(maHouse);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("修改成功");
|
||||
} else {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteById(Integer id) {
|
||||
int result = maHouseDao.deleteById(id);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
} else {
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<?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.bonus.material.mapper.MaHouseMapper">
|
||||
|
||||
<resultMap type="com.bonus.base.api.domain.MaHouse" id="MaHouseMap">
|
||||
<result property="isActive" column="is_active" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="MaHouseMap">
|
||||
select
|
||||
is_active, remark, name, id
|
||||
from ma_house
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="MaHouseMap">
|
||||
select
|
||||
is_active, remark, name, id
|
||||
from ma_house
|
||||
where is_active = '1'
|
||||
<if test="name != null and name != ''">
|
||||
and name like concat('%',#{name},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryByName" resultType="com.bonus.base.api.domain.MaHouse">
|
||||
select
|
||||
is_active, remark, name, id
|
||||
from ma_house
|
||||
where is_active = '1' and name = #{name}
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="" useGeneratedKeys="true">
|
||||
insert into ma_house(is_active, remark, name)
|
||||
values (1, #{remark}, #{name})
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update ma_house
|
||||
<set>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
name = #{name},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
update ma_house
|
||||
set is_active = '0'
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue