类型管理
This commit is contained in:
parent
76d497aebf
commit
4379d64217
|
|
@ -21,6 +21,8 @@ import java.util.List;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class MaType extends BaseEntity implements Serializable {
|
public class MaType extends BaseEntity implements Serializable {
|
||||||
private static final long serialVersionUID = 135108051525707131L;
|
private static final long serialVersionUID = 135108051525707131L;
|
||||||
|
|
||||||
|
private Integer isExport;
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
|
|
@ -51,21 +53,26 @@ public class MaType extends BaseEntity implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 库存
|
* 库存
|
||||||
*/
|
*/
|
||||||
private String storageNum;
|
private Integer storageNum;
|
||||||
/**
|
/**
|
||||||
* 计量单位id
|
* 计量单位id
|
||||||
*/
|
*/
|
||||||
private String unitId;
|
private String unitId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计量单位名称
|
||||||
|
*/
|
||||||
|
private String unitName;
|
||||||
/**
|
/**
|
||||||
* 采购单价
|
* 采购单价
|
||||||
*/
|
*/
|
||||||
private String buyPrice;
|
private Integer buyPrice;
|
||||||
/**
|
/**
|
||||||
* 租赁单价
|
* 租赁单价
|
||||||
*/
|
*/
|
||||||
private String leasePrice;
|
private Integer leasePrice;
|
||||||
/**
|
/**
|
||||||
* 管理类型0是编码1计数
|
* 管理类型(0是编码 1数量和编码 2数量)
|
||||||
*/
|
*/
|
||||||
private String manageType;
|
private String manageType;
|
||||||
/**
|
/**
|
||||||
|
|
@ -81,7 +88,7 @@ public class MaType extends BaseEntity implements Serializable {
|
||||||
*/
|
*/
|
||||||
private String testLoad;
|
private String testLoad;
|
||||||
/**
|
/**
|
||||||
* 持荷时间
|
* 持荷时间 (分钟)
|
||||||
*/
|
*/
|
||||||
private String holdTime;
|
private String holdTime;
|
||||||
/**
|
/**
|
||||||
|
|
@ -93,6 +100,11 @@ public class MaType extends BaseEntity implements Serializable {
|
||||||
*/
|
*/
|
||||||
private String companyId;
|
private String companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否试验(0 否 1是)
|
||||||
|
*/
|
||||||
|
private String isTest;
|
||||||
|
|
||||||
/** 子节点 */
|
/** 子节点 */
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
private List<MaType> children = new ArrayList<>();
|
private List<MaType> children = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -42,20 +42,4 @@ public interface RemoteDictService {
|
||||||
@GetMapping(value = "/dict/data/type/{dictType}")
|
@GetMapping(value = "/dict/data/type/{dictType}")
|
||||||
public R<List<Object>> getDictData(@RequestParam(value = "dictType", required = false) String dictType);
|
public R<List<Object>> getDictData(@RequestParam(value = "dictType", required = false) String dictType);
|
||||||
|
|
||||||
/**
|
|
||||||
* 往来单位树
|
|
||||||
* @param sysDept
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/customer/customerTree")
|
|
||||||
public R<List<TreeSelect>> selectCustomerTree(SysDeptTree sysDept);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工程树
|
|
||||||
* @param sysDept
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/customer/projectTree")
|
|
||||||
public R<List<TreeSelect>> selectProjectTree(SysDeptTree sysDept);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,6 @@ public class RemoteDictFallbackFactory implements FallbackFactory<RemoteDictServ
|
||||||
return R.fail("获取字典数据失败" + throwable.getMessage());
|
return R.fail("获取字典数据失败" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<List<TreeSelect>> selectCustomerTree(SysDeptTree sysDept) {
|
|
||||||
return R.fail("获取往来单位树数据失败" + throwable.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<List<TreeSelect>> selectProjectTree(SysDeptTree sysDept) {
|
|
||||||
return R.fail("获取工程树数据失败" + throwable.getMessage());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,4 +89,13 @@ public class BaseTreeController {
|
||||||
return AjaxResult.success(deptList);
|
return AjaxResult.success(deptList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取计量单位
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getUnitName")
|
||||||
|
public R<Object> getUnitName(){
|
||||||
|
R<List<Object>> bmProNature = remoteDictService.getDictData("ma_unit");
|
||||||
|
return R.ok(bmProNature);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.bonus.material.service.MaTypeService;
|
||||||
import com.bonus.material.vo.MaTypeVo;
|
import com.bonus.material.vo.MaTypeVo;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
@ -25,6 +26,7 @@ import java.util.List;
|
||||||
@Api(tags = "机具类型管理")
|
@Api(tags = "机具类型管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/maType")
|
@RequestMapping("/maType")
|
||||||
|
@Slf4j
|
||||||
public class MaTypeController extends BaseController {
|
public class MaTypeController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 服务对象
|
* 服务对象
|
||||||
|
|
@ -60,6 +62,18 @@ public class MaTypeController extends BaseController {
|
||||||
return success(getDataTable(listByMaType));
|
return success(getDataTable(listByMaType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询用于回显
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "根据id查询")
|
||||||
|
@GetMapping("/selectById")
|
||||||
|
public AjaxResult selectById(@RequestParam(value = "id") Integer id) {
|
||||||
|
MaType maType = maTypeService.selectById(id);
|
||||||
|
return success(maType);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增数据返回code
|
* 新增数据返回code
|
||||||
*
|
*
|
||||||
|
|
@ -124,6 +138,7 @@ public class MaTypeController extends BaseController {
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, MaType maType)
|
public void export(HttpServletResponse response, MaType maType)
|
||||||
{
|
{
|
||||||
|
maType.setIsExport(1);
|
||||||
List<MaTypeVo> list = maTypeService.getListByParentId(maType);
|
List<MaTypeVo> list = maTypeService.getListByParentId(maType);
|
||||||
ExcelUtil<MaTypeVo> util = new ExcelUtil<>(MaTypeVo.class);
|
ExcelUtil<MaTypeVo> util = new ExcelUtil<>(MaTypeVo.class);
|
||||||
util.exportExcel(response, list, "物资类型数据");
|
util.exportExcel(response, list, "物资类型数据");
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.bonus.material.mapper;
|
||||||
|
|
||||||
import com.bonus.base.api.domain.MaType;
|
import com.bonus.base.api.domain.MaType;
|
||||||
import com.bonus.material.vo.MaTypeVo;
|
import com.bonus.material.vo.MaTypeVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -22,23 +21,6 @@ public interface MaTypeMapper {
|
||||||
*/
|
*/
|
||||||
int insert(MaType maType);
|
int insert(MaType maType);
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增数据(MyBatis原生foreach方法)
|
|
||||||
*
|
|
||||||
* @param entities List<MaType> 实例对象列表
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int insertBatch(@Param("entities") List<MaType> entities);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
|
||||||
*
|
|
||||||
* @param entities List<MaType> 实例对象列表
|
|
||||||
* @return 影响行数
|
|
||||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
|
||||||
*/
|
|
||||||
int insertOrUpdateBatch(@Param("entities") List<MaType> entities);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改数据
|
* 修改数据
|
||||||
*
|
*
|
||||||
|
|
@ -100,5 +82,12 @@ public interface MaTypeMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int deleteById(Integer id);
|
int deleteById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
MaType select(Integer id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@ import com.bonus.base.api.domain.MaType;
|
||||||
import com.bonus.base.api.domain.TreeSelect;
|
import com.bonus.base.api.domain.TreeSelect;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.material.vo.MaTypeVo;
|
import com.bonus.material.vo.MaTypeVo;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -66,4 +64,11 @@ public interface MaTypeService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult deleteById(Integer id);
|
AjaxResult deleteById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
MaType selectById(Integer id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ public class MaTypeServiceImpl implements MaTypeService {
|
||||||
public AjaxResult insert(MaType maType) {
|
public AjaxResult insert(MaType maType) {
|
||||||
//根据类型名称判断,去重
|
//根据类型名称判断,去重
|
||||||
MaType type = maTypeDao.queryByName(maType.getName());
|
MaType type = maTypeDao.queryByName(maType.getName());
|
||||||
if (type != null && maType.getId().equals(type.getParentId())) {
|
if (type != null && maType.getParentId().equals(type.getParentId())) {
|
||||||
return AjaxResult.error("同级下类型名称存在重复!");
|
return AjaxResult.error("同级下类型名称存在重复!");
|
||||||
}
|
}
|
||||||
maType.setLevel(String.valueOf(Integer.parseInt(maType.getLevel()) + 1));
|
maType.setLevel(String.valueOf(Integer.parseInt(maType.getLevel()) + 1));
|
||||||
|
|
@ -58,8 +58,8 @@ public class MaTypeServiceImpl implements MaTypeService {
|
||||||
public AjaxResult update(MaType maType) {
|
public AjaxResult update(MaType maType) {
|
||||||
//根据类型名称判断,去重
|
//根据类型名称判断,去重
|
||||||
MaType type = maTypeDao.queryByName(maType.getName());
|
MaType type = maTypeDao.queryByName(maType.getName());
|
||||||
if (type != null) {
|
if (type != null && maType.getParentId().equals(type.getParentId())) {
|
||||||
return AjaxResult.error("类型名称重复");
|
return AjaxResult.error("同级下类型名称存在重复!");
|
||||||
}
|
}
|
||||||
int result = maTypeDao.update(maType);
|
int result = maTypeDao.update(maType);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
|
|
@ -87,7 +87,24 @@ public class MaTypeServiceImpl implements MaTypeService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<MaTypeVo> getListByParentId(MaType maType) {
|
public List<MaTypeVo> getListByParentId(MaType maType) {
|
||||||
return maTypeDao.getListByParentId(maType);
|
List<MaTypeVo> maTypeVos = maTypeDao.getListByParentId(maType);
|
||||||
|
if (CollectionUtils.isNotEmpty(maTypeVos)) {
|
||||||
|
for (MaTypeVo maTypeVo : maTypeVos) {
|
||||||
|
if (maTypeVo.getIsTest() != null && "1".equals(maTypeVo.getIsTest())) {
|
||||||
|
maTypeVo.setIsTest("是");
|
||||||
|
} else {
|
||||||
|
maTypeVo.setIsTest("否");
|
||||||
|
}
|
||||||
|
if (maTypeVo.getManageType() != null && "0".equals(maTypeVo.getManageType())) {
|
||||||
|
maTypeVo.setManageType("编码追溯");
|
||||||
|
} else if (maTypeVo.getManageType() != null && "1".equals(maTypeVo.getManageType())) {
|
||||||
|
maTypeVo.setManageType("数量+编码");
|
||||||
|
} else {
|
||||||
|
maTypeVo.setManageType("数量");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maTypeVos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -190,6 +207,16 @@ public class MaTypeServiceImpl implements MaTypeService {
|
||||||
return AjaxResult.error("删除失败");
|
return AjaxResult.error("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public MaType selectById(Integer id) {
|
||||||
|
return maTypeDao.select(id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要下拉树结构
|
* 构建前端所需要下拉树结构
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,6 @@ import lombok.NoArgsConstructor;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class MaTypeVo extends MaType {
|
public class MaTypeVo extends MaType {
|
||||||
|
|
||||||
@ApiModelProperty("类型编码")
|
|
||||||
@Excel(name = "类型编码")
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
@ApiModelProperty("仓库信息")
|
@ApiModelProperty("仓库信息")
|
||||||
private String wareHouse ;
|
private String wareHouse ;
|
||||||
|
|
||||||
|
|
@ -40,6 +36,66 @@ public class MaTypeVo extends MaType {
|
||||||
@Excel(name = "规格型号")
|
@Excel(name = "规格型号")
|
||||||
private String specificationCode;
|
private String specificationCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级
|
||||||
|
*/
|
||||||
|
private String level;
|
||||||
|
|
||||||
|
@ApiModelProperty("类型编码")
|
||||||
|
@Excel(name = "类型编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty("单位名称")
|
||||||
|
@Excel(name = "单位")
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理类型(0是编码 1数量和编码 2数量)
|
||||||
|
*/
|
||||||
|
@Excel(name = "管理类型")
|
||||||
|
private String manageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存
|
||||||
|
*/
|
||||||
|
@Excel(name = "库存")
|
||||||
|
private Integer storageNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购单价
|
||||||
|
*/
|
||||||
|
@Excel(name = "购置价格")
|
||||||
|
private Integer buyPrice;
|
||||||
|
/**
|
||||||
|
* 租赁单价
|
||||||
|
*/
|
||||||
|
@Excel(name = "租赁价格")
|
||||||
|
private Integer leasePrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 持荷时间 (分钟)
|
||||||
|
*/
|
||||||
|
@Excel(name = "持荷时间 (分钟)")
|
||||||
|
private String holdTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否试验(0 否 1是)
|
||||||
|
*/
|
||||||
|
@Excel(name = "是否试验")
|
||||||
|
private String isTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试验载荷
|
||||||
|
*/
|
||||||
|
@Excel(name = "试验载荷")
|
||||||
|
private String testLoad;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额定载荷
|
||||||
|
*/
|
||||||
|
@Excel(name = "额定载荷")
|
||||||
|
private String rateLoad;
|
||||||
|
|
||||||
@ApiModelProperty("新增类型编码")
|
@ApiModelProperty("新增类型编码")
|
||||||
private String newCode;
|
private String newCode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@
|
||||||
<result property="parentId" column="parent_id" jdbcType="INTEGER"/>
|
<result property="parentId" column="parent_id" jdbcType="INTEGER"/>
|
||||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||||
<result property="level" column="level" jdbcType="VARCHAR"/>
|
<result property="level" column="level" jdbcType="VARCHAR"/>
|
||||||
<result property="storageNum" column="storage_num" jdbcType="VARCHAR"/>
|
<result property="storageNum" column="storage_num" jdbcType="INTEGER"/>
|
||||||
<result property="unitId" column="unit_id" jdbcType="VARCHAR"/>
|
<result property="unitId" column="unit_id" jdbcType="VARCHAR"/>
|
||||||
<result property="buyPrice" column="buy_price" jdbcType="VARCHAR"/>
|
<result property="buyPrice" column="buy_price" jdbcType="INTEGER"/>
|
||||||
<result property="leasePrice" column="lease_price" jdbcType="VARCHAR"/>
|
<result property="leasePrice" column="lease_price" jdbcType="INTEGER"/>
|
||||||
<result property="manageType" column="manage_type" jdbcType="VARCHAR"/>
|
<result property="manageType" column="manage_type" jdbcType="VARCHAR"/>
|
||||||
<result property="isActive" column="is_active" jdbcType="VARCHAR"/>
|
<result property="isActive" column="is_active" jdbcType="VARCHAR"/>
|
||||||
<result property="rateLoad" column="rate_load" jdbcType="VARCHAR"/>
|
<result property="rateLoad" column="rate_load" jdbcType="VARCHAR"/>
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
<result property="holdTime" column="hold_time" jdbcType="VARCHAR"/>
|
<result property="holdTime" column="hold_time" jdbcType="VARCHAR"/>
|
||||||
<result property="fileUrl" column="file_url" jdbcType="VARCHAR"/>
|
<result property="fileUrl" column="file_url" jdbcType="VARCHAR"/>
|
||||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="isTest" column="is_test" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<update id="update">
|
<update id="update">
|
||||||
|
|
@ -47,9 +48,6 @@
|
||||||
<if test="manageType != null">
|
<if test="manageType != null">
|
||||||
manage_type = #{manageType},
|
manage_type = #{manageType},
|
||||||
</if>
|
</if>
|
||||||
<if test="isActive != null">
|
|
||||||
is_active = #{isActive},
|
|
||||||
</if>
|
|
||||||
<if test="rateLoad != null">
|
<if test="rateLoad != null">
|
||||||
rate_load = #{rateLoad},
|
rate_load = #{rateLoad},
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -65,8 +63,11 @@
|
||||||
<if test="companyId != null">
|
<if test="companyId != null">
|
||||||
company_id = #{companyId},
|
company_id = #{companyId},
|
||||||
</if>
|
</if>
|
||||||
where id = #{id}
|
<if test="isTest != null">
|
||||||
|
is_test = #{isTest}
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
<delete id="deleteById">
|
<delete id="deleteById">
|
||||||
update ma_type set is_active = '0' where id = #{id}
|
update ma_type set is_active = '0' where id = #{id}
|
||||||
|
|
@ -91,28 +92,47 @@
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
mt.id,
|
mt.id,
|
||||||
|
f.`name` AS constructionType,
|
||||||
|
s.`name` AS materialType,
|
||||||
|
mtp.`name` AS materialName,
|
||||||
mt.`name` AS specificationCode,
|
mt.`name` AS specificationCode,
|
||||||
mt.`level`,
|
mt.`level`,
|
||||||
mtp.`name` AS materialName,
|
mt.`code` AS code,
|
||||||
s.`name` AS materialType,
|
sda.dict_label as unitName,
|
||||||
f.`name` AS constructionType,
|
mt.manage_type as manageType,
|
||||||
mt.`code`,
|
mt.storage_num as storageNum,
|
||||||
|
mt.buy_price as buyPrice,
|
||||||
|
mt.lease_price as leasePrice,
|
||||||
|
mt.hold_time as hold_time,
|
||||||
|
mt.is_test as isTest,
|
||||||
|
mt.test_load as testLoad,
|
||||||
|
mt.rate_load as rateLoad,
|
||||||
mt.is_active
|
mt.is_active
|
||||||
FROM
|
FROM
|
||||||
ma_type mt
|
ma_type mt
|
||||||
LEFT JOIN ma_type mtp ON mtp.id = mt.parent_id
|
LEFT JOIN ma_type mtp ON mtp.id = mt.parent_id
|
||||||
LEFT JOIN ma_type s ON s.id = mtp.parent_id
|
LEFT JOIN ma_type s ON s.id = mtp.parent_id
|
||||||
LEFT JOIN ma_type f ON f.id = s.parent_id
|
LEFT JOIN ma_type f ON f.id = s.parent_id
|
||||||
|
LEFT JOIN sys_dict_data sda on mt.unit_id = sda.dict_code
|
||||||
WHERE
|
WHERE
|
||||||
mt.`LEVEL` = 4 UNION
|
mt.`LEVEL` = 4 UNION
|
||||||
SELECT
|
SELECT
|
||||||
mt.id,
|
mt.id,
|
||||||
|
s.`name` AS constructionType,
|
||||||
|
mtp.`name` AS materialType,
|
||||||
|
mt.`name` AS materialName,
|
||||||
NULL AS `NAME`,
|
NULL AS `NAME`,
|
||||||
mt.`level`,
|
mt.`level`,
|
||||||
mt.`name` AS materialName,
|
|
||||||
mtp.`name` AS materialType,
|
|
||||||
s.`name` AS constructionType,
|
|
||||||
mt.`CODE`,
|
mt.`CODE`,
|
||||||
|
mt.storage_num as storageNum,
|
||||||
|
mt.buy_price as buyPrice,
|
||||||
|
mt.lease_price as leasePrice,
|
||||||
|
mt.hold_time as hold_time,
|
||||||
|
mt.is_test as isTest,
|
||||||
|
mt.test_load as testLoad,
|
||||||
|
mt.rate_load as rateLoad,
|
||||||
|
NULL as unitName,
|
||||||
|
mt.manage_type as manageType,
|
||||||
mt.is_active
|
mt.is_active
|
||||||
FROM
|
FROM
|
||||||
ma_type mt
|
ma_type mt
|
||||||
|
|
@ -122,13 +142,22 @@
|
||||||
mt.`LEVEL` = 3 UNION
|
mt.`LEVEL` = 3 UNION
|
||||||
SELECT
|
SELECT
|
||||||
mt.id AS id,
|
mt.id AS id,
|
||||||
|
mtp.`NAME` AS constructionType,
|
||||||
|
mt.`NAME` AS materialType,
|
||||||
|
NULL AS materialName,
|
||||||
NULL AS `NAME`,
|
NULL AS `NAME`,
|
||||||
mt.`level`,
|
mt.`level`,
|
||||||
NULL AS materialName,
|
|
||||||
mt.`NAME` AS materialType,
|
|
||||||
mtp.`NAME` AS constructionType,
|
|
||||||
mt.`CODE`,
|
mt.`CODE`,
|
||||||
mt.IS_ACTIVE AS enabled
|
mt.storage_num as storageNum,
|
||||||
|
mt.buy_price as buyPrice,
|
||||||
|
mt.lease_price as leasePrice,
|
||||||
|
mt.hold_time as hold_time,
|
||||||
|
mt.is_test as isTest,
|
||||||
|
mt.test_load as testLoad,
|
||||||
|
mt.rate_load as rateLoad,
|
||||||
|
NULL as unitName,
|
||||||
|
mt.manage_type as manageType,
|
||||||
|
mt.IS_ACTIVE
|
||||||
FROM
|
FROM
|
||||||
ma_type mt
|
ma_type mt
|
||||||
LEFT JOIN ma_type mtp ON mtp.id = mt.PARENT_ID
|
LEFT JOIN ma_type mtp ON mtp.id = mt.PARENT_ID
|
||||||
|
|
@ -136,13 +165,22 @@
|
||||||
mt.`LEVEL` = 2 UNION
|
mt.`LEVEL` = 2 UNION
|
||||||
SELECT
|
SELECT
|
||||||
mt.id AS id,
|
mt.id AS id,
|
||||||
|
mt.`NAME` AS constructionType,
|
||||||
|
NULL AS materialType,
|
||||||
|
NULL AS materialName,
|
||||||
NULL AS `NAME`,
|
NULL AS `NAME`,
|
||||||
mt.`level`,
|
mt.`level`,
|
||||||
NULL AS materialName,
|
|
||||||
NULL AS materialType,
|
|
||||||
mt.`NAME` AS constructionType,
|
|
||||||
mt.`CODE`,
|
mt.`CODE`,
|
||||||
mt.IS_ACTIVE AS enabled
|
mt.storage_num as storageNum,
|
||||||
|
mt.buy_price as buyPrice,
|
||||||
|
mt.lease_price as leasePrice,
|
||||||
|
mt.hold_time as hold_time,
|
||||||
|
mt.is_test as isTest,
|
||||||
|
mt.test_load as testLoad,
|
||||||
|
mt.rate_load as rateLoad,
|
||||||
|
NULL as unitName,
|
||||||
|
mt.manage_type as manageType,
|
||||||
|
mt.IS_ACTIVE
|
||||||
FROM
|
FROM
|
||||||
ma_type mt
|
ma_type mt
|
||||||
WHERE
|
WHERE
|
||||||
|
|
@ -150,6 +188,9 @@
|
||||||
) t
|
) t
|
||||||
WHERE
|
WHERE
|
||||||
t.IS_ACTIVE = '1'
|
t.IS_ACTIVE = '1'
|
||||||
|
<if test="isExport != null and isExport == 1">
|
||||||
|
and t.`level`=4
|
||||||
|
</if>
|
||||||
<if test="keyWord != null and keyWord != ''">
|
<if test="keyWord != null and keyWord != ''">
|
||||||
and (
|
and (
|
||||||
t.specificationCode like CONCAT('%',#{keyWord},'%') or
|
t.specificationCode like CONCAT('%',#{keyWord},'%') or
|
||||||
|
|
@ -212,38 +253,14 @@
|
||||||
WHERE
|
WHERE
|
||||||
mt.is_active = '1' and mt.parent_id = #{id}
|
mt.is_active = '1' and mt.parent_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="select" resultType="com.bonus.base.api.domain.MaType">
|
||||||
|
select
|
||||||
|
id as id, code as code, parent_id as parentId, name as name, level as level, storage_num as storageNum, unit_id as unitId, sda.dict_label as unitName, buy_price as buyPrice, lease_price as leasePrice, manage_type as manageType, is_active as isActive, rate_load as rateLoad, test_load as testLoad, hold_time as holdTime, file_url as fileUrl, company_id as companyId, is_test as isTest
|
||||||
|
from ma_type mt
|
||||||
|
left join sys_dict_data sda on mt.unit_id = sda.dict_code
|
||||||
|
where is_active = '1' and id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertBatch" keyProperty="" useGeneratedKeys="true">
|
|
||||||
insert into ma_type(id, parent_id, name, level, storage_num, unit_id, buy_price, lease_price, manage_type, is_active, rate_load, test_load, hold_time, file_url, company_id)
|
|
||||||
values
|
|
||||||
<foreach collection="entities" item="entity" separator=",">
|
|
||||||
(#{entity.id}, #{entity.parentId}, #{entity.name}, #{entity.level}, #{entity.storageNum}, #{entity.unitId}, #{entity.buyPrice}, #{entity.leasePrice}, #{entity.manageType}, #{entity.isActive}, #{entity.rateLoad}, #{entity.testLoad}, #{entity.holdTime}, #{entity.fileUrl}, #{entity.companyId})
|
|
||||||
</foreach>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<insert id="insertOrUpdateBatch" keyProperty="" useGeneratedKeys="true">
|
|
||||||
insert into ma_type(id, parent_id, name, level, storage_num, unit_id, buy_price, lease_price, manage_type, is_active, rate_load, test_load, hold_time, file_url, company_id)
|
|
||||||
values
|
|
||||||
<foreach collection="entities" item="entity" separator=",">
|
|
||||||
(#{entity.id}, #{entity.parentId}, #{entity.name}, #{entity.level}, #{entity.storageNum}, #{entity.unitId}, #{entity.buyPrice}, #{entity.leasePrice}, #{entity.manageType}, #{entity.isActive}, #{entity.rateLoad}, #{entity.testLoad}, #{entity.holdTime}, #{entity.fileUrl}, #{entity.companyId})
|
|
||||||
</foreach>
|
|
||||||
on duplicate key update
|
|
||||||
id = values(id),
|
|
||||||
parent_id = values(parent_id),
|
|
||||||
name = values(name),
|
|
||||||
level = values(level),
|
|
||||||
storage_num = values(storage_num),
|
|
||||||
unit_id = values(unit_id),
|
|
||||||
buy_price = values(buy_price),
|
|
||||||
lease_price = values(lease_price),
|
|
||||||
manage_type = values(manage_type),
|
|
||||||
is_active = values(is_active),
|
|
||||||
rate_load = values(rate_load),
|
|
||||||
test_load = values(test_load),
|
|
||||||
hold_time = values(hold_time),
|
|
||||||
file_url = values(file_url),
|
|
||||||
company_id = values(company_id)
|
|
||||||
</insert>
|
|
||||||
<insert id="insert">
|
<insert id="insert">
|
||||||
INSERT INTO ma_type
|
INSERT INTO ma_type
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
@ -262,6 +279,7 @@
|
||||||
<if test="holdTime != null and holdTime != ''">hold_time,</if>
|
<if test="holdTime != null and holdTime != ''">hold_time,</if>
|
||||||
<if test="fileUrl != null and fileUrl != ''">file_url,</if>
|
<if test="fileUrl != null and fileUrl != ''">file_url,</if>
|
||||||
<if test="companyId != null and companyId != ''">company_id,</if>
|
<if test="companyId != null and companyId != ''">company_id,</if>
|
||||||
|
<if test="isTest != null and isTest != ''">is_test,</if>
|
||||||
</trim>
|
</trim>
|
||||||
VALUES
|
VALUES
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
@ -280,6 +298,7 @@
|
||||||
<if test="holdTime != null and holdTime != ''">#{holdTime},</if>
|
<if test="holdTime != null and holdTime != ''">#{holdTime},</if>
|
||||||
<if test="fileUrl != null and fileUrl != ''">#{fileUrl},</if>
|
<if test="fileUrl != null and fileUrl != ''">#{fileUrl},</if>
|
||||||
<if test="companyId != null and companyId != ''">#{companyId},</if>
|
<if test="companyId != null and companyId != ''">#{companyId},</if>
|
||||||
|
<if test="isTest != null and isTest != ''">#{isTest},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue