add - 工厂管理、产线管理

master
yinq 1 year ago
parent b34877157f
commit 9ff0880773

@ -0,0 +1,114 @@
package com.aucma.base.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.aucma.common.utils.DateUtils;
import org.springframework.security.access.prepost.PreAuthorize;
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.aucma.common.annotation.Log;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.enums.BusinessType;
import com.aucma.base.domain.BaseFactory;
import com.aucma.base.service.IBaseFactoryService;
import com.aucma.common.utils.poi.ExcelUtil;
import com.aucma.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2023-09-18
*/
@RestController
@RequestMapping("/base/factory")
public class BaseFactoryController extends BaseController {
@Autowired
private IBaseFactoryService baseFactoryService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:factory:list')")
@GetMapping("/list")
public TableDataInfo list(BaseFactory baseFactory) {
startPage();
List<BaseFactory> list = baseFactoryService.selectBaseFactoryList(baseFactory);
return getDataTable(list);
}
/**
*
* @param baseFactory
* @return
*/
@GetMapping("/findFactoryList")
public AjaxResult findFactoryList(BaseFactory baseFactory) {
List<BaseFactory> list = baseFactoryService.selectBaseFactoryList(baseFactory);
return success(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:factory:export')")
@Log(title = "工厂管理" , businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseFactory baseFactory) {
List<BaseFactory> list = baseFactoryService.selectBaseFactoryList(baseFactory);
ExcelUtil<BaseFactory> util = new ExcelUtil<BaseFactory>(BaseFactory.class);
util.exportExcel(response, list, "工厂管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:factory:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
return success(baseFactoryService.selectBaseFactoryByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:factory:add')")
@Log(title = "工厂管理" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseFactory baseFactory) {
baseFactory.setCreatedBy(getUsername());
baseFactory.setCreatedTime(DateUtils.getNowDate());
return toAjax(baseFactoryService.insertBaseFactory(baseFactory));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:factory:edit')")
@Log(title = "工厂管理" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseFactory baseFactory) {
baseFactory.setUpdatedBy(getUsername());
baseFactory.setUpdatedTime(DateUtils.getNowDate());
return toAjax(baseFactoryService.updateBaseFactory(baseFactory));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:factory:remove')")
@Log(title = "工厂管理" , businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(baseFactoryService.deleteBaseFactoryByObjIds(objIds));
}
}

@ -0,0 +1,103 @@
package com.aucma.base.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.aucma.common.utils.DateUtils;
import org.springframework.security.access.prepost.PreAuthorize;
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.aucma.common.annotation.Log;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.enums.BusinessType;
import com.aucma.base.domain.BaseProductline;
import com.aucma.base.service.IBaseProductlineService;
import com.aucma.common.utils.poi.ExcelUtil;
import com.aucma.common.core.page.TableDataInfo;
/**
* 线Controller
*
* @author Yinq
* @date 2023-09-18
*/
@RestController
@RequestMapping("/base/productline")
public class BaseProductlineController extends BaseController {
@Autowired
private IBaseProductlineService baseProductlineService;
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('base:productline:list')")
@GetMapping("/list")
public TableDataInfo list(BaseProductline baseProductline) {
startPage();
List<BaseProductline> list = baseProductlineService.selectBaseProductlineList(baseProductline);
return getDataTable(list);
}
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('base:productline:export')")
@Log(title = "产线信息" , businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseProductline baseProductline) {
List<BaseProductline> list = baseProductlineService.selectBaseProductlineList(baseProductline);
ExcelUtil<BaseProductline> util = new ExcelUtil<BaseProductline>(BaseProductline.class);
util.exportExcel(response, list, "产线信息数据");
}
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('base:productline:query')")
@GetMapping(value = "/{objid}")
public AjaxResult getInfo(@PathVariable("objid") Long objid) {
return success(baseProductlineService.selectBaseProductlineByObjid(objid));
}
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('base:productline:add')")
@Log(title = "产线信息" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseProductline baseProductline) {
baseProductline.setCreatedBy(getUsername());
baseProductline.setCreatedTime(DateUtils.getNowDate());
return toAjax(baseProductlineService.insertBaseProductline(baseProductline));
}
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('base:productline:edit')")
@Log(title = "产线信息" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseProductline baseProductline) {
baseProductline.setUpdatedBy(getUsername());
baseProductline.setUpdatedTime(DateUtils.getNowDate());
return toAjax(baseProductlineService.updateBaseProductline(baseProductline));
}
/**
* 线
*/
@PreAuthorize("@ss.hasPermi('base:productline:remove')")
@Log(title = "产线信息" , businessType = BusinessType.DELETE)
@DeleteMapping("/{objids}")
public AjaxResult remove(@PathVariable Long[] objids) {
return toAjax(baseProductlineService.deleteBaseProductlineByObjids(objids));
}
}

@ -0,0 +1,162 @@
package com.aucma.base.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.aucma.common.annotation.Excel;
import com.aucma.common.core.domain.BaseEntity;
/**
* base_factory
*
* @author Yinq
* @date 2023-09-18
*/
public class BaseFactory extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objId;
/**
*
*/
@Excel(name = "公司名称")
private String companyName;
/**
*
*/
@Excel(name = "工厂编号")
private String factoryCode;
/**
*
*/
@Excel(name = "工厂名称")
private String factoryName;
/**
*
*/
@Excel(name = "工厂状态")
private String factoryStatus;
/**
*
*/
@Excel(name = "创建人")
private String createdBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
/**
*
*/
@Excel(name = "更新人")
private String updatedBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
public void setObjId(Long objId) {
this.objId = objId;
}
public Long getObjId() {
return objId;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getCompanyName() {
return companyName;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryStatus(String factoryStatus) {
this.factoryStatus = factoryStatus;
}
public String getFactoryStatus() {
return factoryStatus;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getCreatedTime() {
return createdTime;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
public Date getUpdatedTime() {
return updatedTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objId" , getObjId())
.append("companyName" , getCompanyName())
.append("factoryCode" , getFactoryCode())
.append("factoryName" , getFactoryName())
.append("factoryStatus" , getFactoryStatus())
.append("remark" , getRemark())
.append("createdBy" , getCreatedBy())
.append("createdTime" , getCreatedTime())
.append("updatedBy" , getUpdatedBy())
.append("updatedTime" , getUpdatedTime())
.toString();
}
}

@ -0,0 +1,191 @@
package com.aucma.base.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.aucma.common.annotation.Excel;
import com.aucma.common.core.domain.BaseEntity;
/**
* 线 base_productline
*
* @author Yinq
* @date 2023-09-18
*/
public class BaseProductline extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objid;
/**
* 线
*/
@Excel(name = "产线编号")
private String productlineCode;
/**
* 线
*/
@Excel(name = "产线名称")
private String productlineName;
/**
* 线1-线2-
*/
@Excel(name = "产线类别" , readConverterExp = "1=-产线2-工位")
private Long productlineType;
/**
*
*/
@Excel(name = "所属工厂编号")
private String plantCode;
/**
*
*/
@Excel(name = "所属工厂名称")
private String plantName;
/**
*
*/
@Excel(name = "启用标识")
private Long isFlag;
/**
*
*/
@Excel(name = "创建人")
private String createdBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
/**
*
*/
@Excel(name = "更新人")
private String updatedBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
public String getPlantName() {
return plantName;
}
public void setPlantName(String plantName) {
this.plantName = plantName;
}
public void setObjid(Long objid) {
this.objid = objid;
}
public Long getObjid() {
return objid;
}
public void setProductlineCode(String productlineCode) {
this.productlineCode = productlineCode;
}
public String getProductlineCode() {
return productlineCode;
}
public void setProductlineName(String productlineName) {
this.productlineName = productlineName;
}
public String getProductlineName() {
return productlineName;
}
public void setProductlineType(Long productlineType) {
this.productlineType = productlineType;
}
public Long getProductlineType() {
return productlineType;
}
public void setPlantCode(String plantCode) {
this.plantCode = plantCode;
}
public String getPlantCode() {
return plantCode;
}
public void setIsFlag(Long isFlag) {
this.isFlag = isFlag;
}
public Long getIsFlag() {
return isFlag;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getCreatedTime() {
return createdTime;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
public Date getUpdatedTime() {
return updatedTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objid" , getObjid())
.append("productlineCode" , getProductlineCode())
.append("productlineName" , getProductlineName())
.append("productlineType" , getProductlineType())
.append("plantCode" , getPlantCode())
.append("isFlag" , getIsFlag())
.append("createdBy" , getCreatedBy())
.append("createdTime" , getCreatedTime())
.append("updatedBy" , getUpdatedBy())
.append("updatedTime" , getUpdatedTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.aucma.base.mapper;
import java.util.List;
import com.aucma.base.domain.BaseFactory;
/**
* Mapper
*
* @author Yinq
* @date 2023-09-18
*/
public interface BaseFactoryMapper
{
/**
*
*
* @param objId
* @return
*/
public BaseFactory selectBaseFactoryByObjId(Long objId);
/**
*
*
* @param baseFactory
* @return
*/
public List<BaseFactory> selectBaseFactoryList(BaseFactory baseFactory);
/**
*
*
* @param baseFactory
* @return
*/
public int insertBaseFactory(BaseFactory baseFactory);
/**
*
*
* @param baseFactory
* @return
*/
public int updateBaseFactory(BaseFactory baseFactory);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseFactoryByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseFactoryByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.aucma.base.mapper;
import java.util.List;
import com.aucma.base.domain.BaseProductline;
/**
* 线Mapper
*
* @author Yinq
* @date 2023-09-18
*/
public interface BaseProductlineMapper
{
/**
* 线
*
* @param objid 线
* @return 线
*/
public BaseProductline selectBaseProductlineByObjid(Long objid);
/**
* 线
*
* @param baseProductline 线
* @return 线
*/
public List<BaseProductline> selectBaseProductlineList(BaseProductline baseProductline);
/**
* 线
*
* @param baseProductline 线
* @return
*/
public int insertBaseProductline(BaseProductline baseProductline);
/**
* 线
*
* @param baseProductline 线
* @return
*/
public int updateBaseProductline(BaseProductline baseProductline);
/**
* 线
*
* @param objid 线
* @return
*/
public int deleteBaseProductlineByObjid(Long objid);
/**
* 线
*
* @param objids
* @return
*/
public int deleteBaseProductlineByObjids(Long[] objids);
}

@ -0,0 +1,61 @@
package com.aucma.base.service;
import java.util.List;
import com.aucma.base.domain.BaseFactory;
/**
* Service
*
* @author Yinq
* @date 2023-09-18
*/
public interface IBaseFactoryService
{
/**
*
*
* @param objId
* @return
*/
public BaseFactory selectBaseFactoryByObjId(Long objId);
/**
*
*
* @param baseFactory
* @return
*/
public List<BaseFactory> selectBaseFactoryList(BaseFactory baseFactory);
/**
*
*
* @param baseFactory
* @return
*/
public int insertBaseFactory(BaseFactory baseFactory);
/**
*
*
* @param baseFactory
* @return
*/
public int updateBaseFactory(BaseFactory baseFactory);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseFactoryByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseFactoryByObjId(Long objId);
}

@ -0,0 +1,61 @@
package com.aucma.base.service;
import java.util.List;
import com.aucma.base.domain.BaseProductline;
/**
* 线Service
*
* @author Yinq
* @date 2023-09-18
*/
public interface IBaseProductlineService
{
/**
* 线
*
* @param objid 线
* @return 线
*/
public BaseProductline selectBaseProductlineByObjid(Long objid);
/**
* 线
*
* @param baseProductline 线
* @return 线
*/
public List<BaseProductline> selectBaseProductlineList(BaseProductline baseProductline);
/**
* 线
*
* @param baseProductline 线
* @return
*/
public int insertBaseProductline(BaseProductline baseProductline);
/**
* 线
*
* @param baseProductline 线
* @return
*/
public int updateBaseProductline(BaseProductline baseProductline);
/**
* 线
*
* @param objids 线
* @return
*/
public int deleteBaseProductlineByObjids(Long[] objids);
/**
* 线
*
* @param objid 线
* @return
*/
public int deleteBaseProductlineByObjid(Long objid);
}

@ -0,0 +1,96 @@
package com.aucma.base.service.impl;
import java.util.Date;
import java.util.List;
import com.aucma.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aucma.base.mapper.BaseFactoryMapper;
import com.aucma.base.domain.BaseFactory;
import com.aucma.base.service.IBaseFactoryService;
/**
* Service
*
* @author Yinq
* @date 2023-09-18
*/
@Service
public class BaseFactoryServiceImpl implements IBaseFactoryService
{
@Autowired
private BaseFactoryMapper baseFactoryMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public BaseFactory selectBaseFactoryByObjId(Long objId)
{
return baseFactoryMapper.selectBaseFactoryByObjId(objId);
}
/**
*
*
* @param baseFactory
* @return
*/
@Override
public List<BaseFactory> selectBaseFactoryList(BaseFactory baseFactory)
{
return baseFactoryMapper.selectBaseFactoryList(baseFactory);
}
/**
*
*
* @param baseFactory
* @return
*/
@Override
public int insertBaseFactory(BaseFactory baseFactory)
{
return baseFactoryMapper.insertBaseFactory(baseFactory);
}
/**
*
*
* @param baseFactory
* @return
*/
@Override
public int updateBaseFactory(BaseFactory baseFactory)
{
return baseFactoryMapper.updateBaseFactory(baseFactory);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteBaseFactoryByObjIds(Long[] objIds)
{
return baseFactoryMapper.deleteBaseFactoryByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteBaseFactoryByObjId(Long objId)
{
return baseFactoryMapper.deleteBaseFactoryByObjId(objId);
}
}

@ -0,0 +1,93 @@
package com.aucma.base.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aucma.base.mapper.BaseProductlineMapper;
import com.aucma.base.domain.BaseProductline;
import com.aucma.base.service.IBaseProductlineService;
/**
* 线Service
*
* @author Yinq
* @date 2023-09-18
*/
@Service
public class BaseProductlineServiceImpl implements IBaseProductlineService
{
@Autowired
private BaseProductlineMapper baseProductlineMapper;
/**
* 线
*
* @param objid 线
* @return 线
*/
@Override
public BaseProductline selectBaseProductlineByObjid(Long objid)
{
return baseProductlineMapper.selectBaseProductlineByObjid(objid);
}
/**
* 线
*
* @param baseProductline 线
* @return 线
*/
@Override
public List<BaseProductline> selectBaseProductlineList(BaseProductline baseProductline)
{
return baseProductlineMapper.selectBaseProductlineList(baseProductline);
}
/**
* 线
*
* @param baseProductline 线
* @return
*/
@Override
public int insertBaseProductline(BaseProductline baseProductline)
{
return baseProductlineMapper.insertBaseProductline(baseProductline);
}
/**
* 线
*
* @param baseProductline 线
* @return
*/
@Override
public int updateBaseProductline(BaseProductline baseProductline)
{
return baseProductlineMapper.updateBaseProductline(baseProductline);
}
/**
* 线
*
* @param objids 线
* @return
*/
@Override
public int deleteBaseProductlineByObjids(Long[] objids)
{
return baseProductlineMapper.deleteBaseProductlineByObjids(objids);
}
/**
* 线
*
* @param objid 线
* @return
*/
@Override
public int deleteBaseProductlineByObjid(Long objid)
{
return baseProductlineMapper.deleteBaseProductlineByObjid(objid);
}
}

@ -0,0 +1,101 @@
<?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.aucma.base.mapper.BaseFactoryMapper">
<resultMap type="BaseFactory" id="BaseFactoryResult">
<result property="objId" column="obj_id" />
<result property="companyName" column="company_name" />
<result property="factoryCode" column="factory_code" />
<result property="factoryName" column="factory_name" />
<result property="factoryStatus" column="factory_status" />
<result property="remark" column="remark" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
</resultMap>
<sql id="selectBaseFactoryVo">
select obj_id, company_name, factory_code, factory_name, factory_status,
remark, created_by, created_time, updated_by, updated_time from base_factory
</sql>
<select id="selectBaseFactoryList" parameterType="BaseFactory" resultMap="BaseFactoryResult">
<include refid="selectBaseFactoryVo"/>
<where>
<if test="companyName != null and companyName != ''"> and company_name like concat(concat('%', #{companyName}), '%')</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="factoryName != null and factoryName != ''"> and factory_name like concat(concat('%', #{factoryName}), '%')</if>
<if test="factoryStatus != null and factoryStatus != ''"> and factory_status = #{factoryStatus}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectBaseFactoryByObjId" parameterType="Long" resultMap="BaseFactoryResult">
<include refid="selectBaseFactoryVo"/>
where obj_id = #{objId}
</select>
<insert id="insertBaseFactory" parameterType="BaseFactory">
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
SELECT seq_base_factory.NEXTVAL as objId FROM DUAL
</selectKey>
insert into base_factory
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objId != null">obj_id,</if>
<if test="companyName != null">company_name,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="factoryName != null">factory_name,</if>
<if test="factoryStatus != null">factory_status,</if>
<if test="remark != null">remark,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objId != null">#{objId},</if>
<if test="companyName != null">#{companyName},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="factoryName != null">#{factoryName},</if>
<if test="factoryStatus != null">#{factoryStatus},</if>
<if test="remark != null">#{remark},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateBaseFactory" parameterType="BaseFactory">
update base_factory
<trim prefix="SET" suffixOverrides=",">
<if test="companyName != null">company_name = #{companyName},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="factoryName != null">factory_name = #{factoryName},</if>
<if test="factoryStatus != null">factory_status = #{factoryStatus},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteBaseFactoryByObjId" parameterType="Long">
delete from base_factory where obj_id = #{objId}
</delete>
<delete id="deleteBaseFactoryByObjIds" parameterType="String">
delete from base_factory where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,118 @@
<?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.aucma.base.mapper.BaseProductlineMapper">
<resultMap type="BaseProductline" id="BaseProductlineResult">
<result property="objid" column="objid"/>
<result property="productlineCode" column="productline_code"/>
<result property="productlineName" column="productline_name"/>
<result property="productlineType" column="productline_type"/>
<result property="plantCode" column="plant_code"/>
<result property="plantName" column="plantName"/>
<result property="isFlag" column="is_flag"/>
<result property="createdBy" column="created_by"/>
<result property="createdTime" column="created_time"/>
<result property="updatedBy" column="updated_by"/>
<result property="updatedTime" column="updated_time"/>
</resultMap>
<sql id="selectBaseProductlineVo">
select bpl.objid,
bpl.productline_code,
bpl.productline_name,
bpl.productline_type,
bpl.plant_code,
bf.factory_name plantName,
bpl.is_flag,
bpl.created_by,
bpl.created_time,
bpl.updated_by,
bpl.updated_time
from base_productline bpl
left join base_factory bf on bf.factory_code = bpl.plant_code
</sql>
<select id="selectBaseProductlineList" parameterType="BaseProductline" resultMap="BaseProductlineResult">
<include refid="selectBaseProductlineVo"/>
<where>
<if test="productlineCode != null and productlineCode != ''">and bpl.productline_code = #{productlineCode}</if>
<if test="productlineName != null and productlineName != ''">and bpl.productline_name like concat(concat('%',
#{productlineName}), '%')
</if>
<if test="productlineType != null ">and bpl.productline_type = #{productlineType}</if>
<if test="plantCode != null and plantCode != ''">and bpl.plant_code = #{plantCode}</if>
<if test="isFlag != null ">and bpl.is_flag = #{isFlag}</if>
<if test="createdBy != null and createdBy != ''">and bpl.created_by = #{createdBy}</if>
<if test="createdTime != null ">and bpl.created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''">and bpl.updated_by = #{updatedBy}</if>
<if test="updatedTime != null ">and bpl.updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectBaseProductlineByObjid" parameterType="Long" resultMap="BaseProductlineResult">
<include refid="selectBaseProductlineVo"/>
where bpl.objid = #{objid}
</select>
<insert id="insertBaseProductline" parameterType="BaseProductline">
<selectKey keyProperty="objid" resultType="long" order="BEFORE">
SELECT seq_base_productline.NEXTVAL as objid FROM DUAL
</selectKey>
insert into base_productline
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objid != null">objid,</if>
<if test="productlineCode != null">productline_code,</if>
<if test="productlineName != null">productline_name,</if>
<if test="productlineType != null">productline_type,</if>
<if test="plantCode != null">plant_code,</if>
<if test="isFlag != null">is_flag,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objid != null">#{objid},</if>
<if test="productlineCode != null">#{productlineCode},</if>
<if test="productlineName != null">#{productlineName},</if>
<if test="productlineType != null">#{productlineType},</if>
<if test="plantCode != null">#{plantCode},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateBaseProductline" parameterType="BaseProductline">
update base_productline
<trim prefix="SET" suffixOverrides=",">
<if test="productlineCode != null">productline_code = #{productlineCode},</if>
<if test="productlineName != null">productline_name = #{productlineName},</if>
<if test="productlineType != null">productline_type = #{productlineType},</if>
<if test="plantCode != null">plant_code = #{plantCode},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where objid = #{objid}
</update>
<delete id="deleteBaseProductlineByObjid" parameterType="Long">
delete
from base_productline
where objid = #{objid}
</delete>
<delete id="deleteBaseProductlineByObjids" parameterType="String">
delete from base_productline where objid in
<foreach item="objid" collection="array" open="(" separator="," close=")">
#{objid}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save