Commit 458c9088 authored by 乾坤平台's avatar 乾坤平台 Committed by 季圣华
Browse files

!27 修改商品类别展示方式为树形结构

Merge pull request !27 from 乾坤平台/master
parents 9fff3f2a ccfdd236
This diff is collapsed.
<!DOCTYPE html>
<html>
<head>
<title>商品类别选择</title>
<meta charset="utf-8">
<!-- 指定以IE8的方式来渲染 -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
<script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/icon.css"/>
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/js/common/common.js"></script>
</head>
<body>
<!-- 数据显示table -->
<div>
<ul id="ttForSelect"></ul>
</div>
<script type="text/javascript">
$(function () {
$('#ttForSelect').tree({
url: '/materialCategory/getMaterialCategoryTree',
animate: true,
onDblClick: function (node) {
//双击修改
forSelectMaterialCategory(node);
}
});
function forSelectMaterialCategory(node) {
console.log(node);
$("#parentName").val(node.text);
$("#parentid").val(node.id);
$('#forSelectMaterialCategoryDlg').dialog('close');
}
});
</script>
</body>
</html>
\ No newline at end of file
......@@ -5291,3 +5291,51 @@ end;
//
DELIMITER ;
 
-- ----------------------------
-- 时间:2019年2月18日
-- version:1.0.3
-- 此次更新修改产品类型表jsh_materialcategory,添加一些字段
-- 特别提醒:之后的sql都是在之前基础上迭代,可以对已存在的系统进行数据保留更新
-- ----------------------------
-- ----------------------------
-- 产品类型表添加字段sort,显示顺序
-- ----------------------------
alter table jsh_materialcategory add sort varchar(10) DEFAULT null COMMENT '显示顺序';
-- ----------------------------
-- 产品类型表添加字段status,状态,0系统默认,1启用,2删除
-- ----------------------------
alter table jsh_materialcategory add status varchar(1) DEFAULT '0' COMMENT '状态,0系统默认,1启用,2删除';
-- ----------------------------
-- 产品类型表添加字段serial_no,编号
-- ----------------------------
alter table jsh_materialcategory add serial_no varchar(100) DEFAULT null COMMENT '编号';
-- ----------------------------
-- 产品类型表添加字段remark,备注
-- ----------------------------
alter table jsh_materialcategory add remark varchar(1024) DEFAULT null COMMENT '备注';
-- ----------------------------
-- 产品类型表添加字段create_time,创建时间
-- ----------------------------
alter table jsh_materialcategory add create_time datetime DEFAULT null COMMENT '创建时间';
-- ----------------------------
-- 产品类型表添加字段creator,创建人
-- ----------------------------
alter table jsh_materialcategory add creator bigint(20) DEFAULT null COMMENT '创建人';
-- ----------------------------
-- 产品类型表添加字段update_time,更新时间
-- ----------------------------
alter table jsh_materialcategory add update_time datetime DEFAULT null COMMENT '更新时间';
-- ----------------------------
-- 产品类型表添加字段updater,更新人
-- ----------------------------
alter table jsh_materialcategory add updater bigint(20) DEFAULT null COMMENT '更新人';
-- ----------------------------
-- 去掉jsh_materialcategory外键
-- ----------------------------
ALTER TABLE jsh_materialcategory DROP FOREIGN KEY FK3EE7F725237A77D8;
-- ----------------------------
-- 修改根目录父节点id为-1
-- ----------------------------
update jsh_materialcategory set ParentId='-1' where id='1'
......@@ -70,6 +70,19 @@ public class BusinessConstants {
public static final String SEQ_TO_STRING_LESS_INSERT = "0";
//单据编号
public static final String DEPOT_NUMBER_SEQ = "depot_number_seq";
/**
* 商品类别根目录id
* */
public static final Long MATERIAL_CATEGORY_ROOT_ID = 1L;
/**
* 商品类别状态
* 0系统默认,1启用,2删除
* */
public static final String MATERIAL_CATEGORY_STATUS_DEFAULT = "0";
public static final String MATERIAL_CATEGORY_STATUS_ENABLE = "1";
public static final String MATERIAL_CATEGORY_STATUS_DELETE = "2";
......
......@@ -59,6 +59,22 @@ public class ExceptionConstants {
//商品库存不足
public static final int MATERIAL_STOCK_NOT_ENOUGH_CODE = 8000004;
public static final String MATERIAL_STOCK_NOT_ENOUGH_MSG = "商品:%s库存不足";
/**
* 商品类别信息
* type = 75
* */
//添加商品类别信息失败
public static final int MATERIAL_CATEGORY_ADD_FAILED_CODE = 7500000;
public static final String MATERIAL_CATEGORY_ADD_FAILED_MSG = "添加商品类别信息失败";
//删除商品类别信息失败
public static final int MATERIAL_CATEGORY_DELETE_FAILED_CODE = 7500001;
public static final String MATERIAL_CATEGORY_DELETE_FAILED_MSG = "删除商品类别信息失败";
//修改商品类别信息失败
public static final int MATERIAL_CATEGORY_EDIT_FAILED_CODE = 7500002;
public static final String MATERIAL_CATEGORY_EDIT_FAILED_MSG = "添加商品类别信息失败";
//商品类别编号已存在
public static final int MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_CODE = 7500003;
public static final String MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_MSG = "商品类别编号已存在";
/**
* 标准正常返回/操作成功返回
......
package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.datasource.entities.MaterialCategory;
import com.jsh.erp.service.materialCategory.MaterialCategoryService;
import com.jsh.erp.utils.BaseResponseInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @author ji—sheng—hua 华夏ERP
*/
@RestController
@RequestMapping(value = "/materialCategory")
public class MaterialCategoryController {
private Logger logger = LoggerFactory.getLogger(MaterialCategoryController.class);
@Resource
private MaterialCategoryService materialCategoryService;
@GetMapping(value = "/getAllList")
public BaseResponseInfo getAllList(@RequestParam("parentId") Long parentId, HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<MaterialCategory> materialCategoryList = materialCategoryService.getAllList(parentId);
res.code = 200;
res.data = materialCategoryList;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据id来查询商品名称
* @param id
* @param request
* @return
*/
@GetMapping(value = "/findById")
public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<MaterialCategory> dataList = materialCategoryService.findById(id);
JSONObject outer = new JSONObject();
if (null != dataList) {
for (MaterialCategory mc : dataList) {
outer.put("name", mc.getName());
outer.put("parentId", mc.getParentid());
}
}
res.code = 200;
res.data = outer;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}
package com.jsh.erp.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.MaterialCategory;
import com.jsh.erp.datasource.entities.SerialNumberEx;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.materialCategory.MaterialCategoryService;
import com.jsh.erp.utils.BaseResponseInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @author ji—sheng—hua 华夏ERP
*/
@RestController
@RequestMapping(value = "/materialCategory")
public class MaterialCategoryController {
private Logger logger = LoggerFactory.getLogger(MaterialCategoryController.class);
@Resource
private MaterialCategoryService materialCategoryService;
@GetMapping(value = "/getAllList")
public BaseResponseInfo getAllList(@RequestParam("parentId") Long parentId, HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<MaterialCategory> materialCategoryList = materialCategoryService.getAllList(parentId);
res.code = 200;
res.data = materialCategoryList;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据id来查询商品名称
* @param id
* @param request
* @return
*/
@RequestMapping(value = "/findById")
public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<MaterialCategory> dataList = materialCategoryService.findById(id);
JSONObject outer = new JSONObject();
if (null != dataList) {
for (MaterialCategory mc : dataList) {
outer.put("id", mc.getId());
outer.put("name", mc.getName());
outer.put("parentId", mc.getParentid());
List<MaterialCategory> dataParentList = materialCategoryService.findById(mc.getParentid());
if(dataParentList!=null&&dataParentList.size()>0){
outer.put("parentName", dataParentList.get(0).getName());
}
outer.put("sort", mc.getSort());
outer.put("serialNo", mc.getSerialNo());
outer.put("remark", mc.getRemark());
}
}
res.code = 200;
res.data = outer;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* create by: cjl
* description:
* 获取商品类别树数据
* create time: 2019/2/19 11:49
* @Param:
* @return com.alibaba.fastjson.JSONArray
*/
@RequestMapping(value = "/getMaterialCategoryTree")
public JSONArray getMaterialCategoryTree() throws Exception{
JSONArray arr=new JSONArray();
List<TreeNode> materialCategoryTree = materialCategoryService.getMaterialCategoryTree();
if(materialCategoryTree!=null&&materialCategoryTree.size()>0){
for(TreeNode node:materialCategoryTree){
String str=JSON.toJSONString(node);
JSONObject obj=JSON.parseObject(str);
arr.add(obj) ;
}
}
return arr;
}
/**
* create by: cjl
* description:
* 新增商品类别数据
* create time: 2019/2/19 17:17
* @Param: beanJson
* @return java.lang.Object
*/
@RequestMapping(value = "/addMaterialCategory")
public Object addMaterialCategory(@RequestParam("info") String beanJson) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess();
MaterialCategory mc= JSON.parseObject(beanJson, MaterialCategory.class);
int i= materialCategoryService.addMaterialCategory(mc);
if(i<1){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_ADD_FAILED_CODE,
ExceptionConstants.MATERIAL_CATEGORY_ADD_FAILED_MSG);
}
return result;
}
/**
* create by: cjl
* description:
* 修改商品类别数据
* create time: 2019/2/20 9:30
* @Param: beanJson
* @return java.lang.Object
*/
@RequestMapping(value = "/editMaterialCategory")
public Object editMaterialCategory(@RequestParam("info") String beanJson) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess();
MaterialCategory mc= JSON.parseObject(beanJson, MaterialCategory.class);
int i= materialCategoryService.editMaterialCategory(mc);
if(i<1){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_ADD_FAILED_CODE,
ExceptionConstants.MATERIAL_CATEGORY_ADD_FAILED_MSG);
}
return result;
}
/**
* create by: cjl
* description:
* 批量删除商品类别信息
* create time: 2019/2/19 17:26
* @Param: ids
* @return java.lang.Object
*/
@RequestMapping(value = "/batchDeleteMaterialCategory")
public Object batchDeleteMaterialCategory(@RequestParam("ids") String ids) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess();
int i= materialCategoryService.batchDeleteMaterialCategoryByIds(ids);
if(i<1){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_DELETE_FAILED_CODE,
ExceptionConstants.MATERIAL_CATEGORY_DELETE_FAILED_MSG);
}
return result;
}
}
package com.jsh.erp.datasource.entities;
public class MaterialCategory {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.Id
*
* @mbggenerated
*/
private Long id;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.Name
*
* @mbggenerated
*/
private String name;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.CategoryLevel
*
* @mbggenerated
*/
private Short categorylevel;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.ParentId
*
* @mbggenerated
*/
private Long parentid;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.Id
*
* @return the value of jsh_materialcategory.Id
*
* @mbggenerated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.Id
*
* @param id the value for jsh_materialcategory.Id
*
* @mbggenerated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.Name
*
* @return the value of jsh_materialcategory.Name
*
* @mbggenerated
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.Name
*
* @param name the value for jsh_materialcategory.Name
*
* @mbggenerated
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.CategoryLevel
*
* @return the value of jsh_materialcategory.CategoryLevel
*
* @mbggenerated
*/
public Short getCategorylevel() {
return categorylevel;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.CategoryLevel
*
* @param categorylevel the value for jsh_materialcategory.CategoryLevel
*
* @mbggenerated
*/
public void setCategorylevel(Short categorylevel) {
this.categorylevel = categorylevel;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.ParentId
*
* @return the value of jsh_materialcategory.ParentId
*
* @mbggenerated
*/
public Long getParentid() {
return parentid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.ParentId
*
* @param parentid the value for jsh_materialcategory.ParentId
*
* @mbggenerated
*/
public void setParentid(Long parentid) {
this.parentid = parentid;
}
package com.jsh.erp.datasource.entities;
import java.util.Date;
public class MaterialCategory {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.Id
*
* @mbggenerated
*/
private Long id;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.Name
*
* @mbggenerated
*/
private String name;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.CategoryLevel
*
* @mbggenerated
*/
private Short categorylevel;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.ParentId
*
* @mbggenerated
*/
private Long parentid;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.sort
*
* @mbggenerated
*/
private String sort;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.status
*
* @mbggenerated
*/
private String status;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.serial_no
*
* @mbggenerated
*/
private String serialNo;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.remark
*
* @mbggenerated
*/
private String remark;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.create_time
*
* @mbggenerated
*/
private Date createTime;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.creator
*
* @mbggenerated
*/
private Long creator;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.update_time
*
* @mbggenerated
*/
private Date updateTime;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialcategory.updater
*
* @mbggenerated
*/
private Long updater;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.Id
*
* @return the value of jsh_materialcategory.Id
*
* @mbggenerated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.Id
*
* @param id the value for jsh_materialcategory.Id
*
* @mbggenerated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.Name
*
* @return the value of jsh_materialcategory.Name
*
* @mbggenerated
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.Name
*
* @param name the value for jsh_materialcategory.Name
*
* @mbggenerated
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.CategoryLevel
*
* @return the value of jsh_materialcategory.CategoryLevel
*
* @mbggenerated
*/
public Short getCategorylevel() {
return categorylevel;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.CategoryLevel
*
* @param categorylevel the value for jsh_materialcategory.CategoryLevel
*
* @mbggenerated
*/
public void setCategorylevel(Short categorylevel) {
this.categorylevel = categorylevel;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.ParentId
*
* @return the value of jsh_materialcategory.ParentId
*
* @mbggenerated
*/
public Long getParentid() {
return parentid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.ParentId
*
* @param parentid the value for jsh_materialcategory.ParentId
*
* @mbggenerated
*/
public void setParentid(Long parentid) {
this.parentid = parentid;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.sort
*
* @return the value of jsh_materialcategory.sort
*
* @mbggenerated
*/
public String getSort() {
return sort;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.sort
*
* @param sort the value for jsh_materialcategory.sort
*
* @mbggenerated
*/
public void setSort(String sort) {
this.sort = sort == null ? null : sort.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.status
*
* @return the value of jsh_materialcategory.status
*
* @mbggenerated
*/
public String getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.status
*
* @param status the value for jsh_materialcategory.status
*
* @mbggenerated
*/
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.serial_no
*
* @return the value of jsh_materialcategory.serial_no
*
* @mbggenerated
*/
public String getSerialNo() {
return serialNo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.serial_no
*
* @param serialNo the value for jsh_materialcategory.serial_no
*
* @mbggenerated
*/
public void setSerialNo(String serialNo) {
this.serialNo = serialNo == null ? null : serialNo.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.remark
*
* @return the value of jsh_materialcategory.remark
*
* @mbggenerated
*/
public String getRemark() {
return remark;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.remark
*
* @param remark the value for jsh_materialcategory.remark
*
* @mbggenerated
*/
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.create_time
*
* @return the value of jsh_materialcategory.create_time
*
* @mbggenerated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.create_time
*
* @param createTime the value for jsh_materialcategory.create_time
*
* @mbggenerated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.creator
*
* @return the value of jsh_materialcategory.creator
*
* @mbggenerated
*/
public Long getCreator() {
return creator;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.creator
*
* @param creator the value for jsh_materialcategory.creator
*
* @mbggenerated
*/
public void setCreator(Long creator) {
this.creator = creator;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.update_time
*
* @return the value of jsh_materialcategory.update_time
*
* @mbggenerated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.update_time
*
* @param updateTime the value for jsh_materialcategory.update_time
*
* @mbggenerated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialcategory.updater
*
* @return the value of jsh_materialcategory.updater
*
* @mbggenerated
*/
public Long getUpdater() {
return updater;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialcategory.updater
*
* @param updater the value for jsh_materialcategory.updater
*
* @mbggenerated
*/
public void setUpdater(Long updater) {
this.updater = updater;
}
}
\ No newline at end of file
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.MaterialCategory;
import com.jsh.erp.datasource.entities.MaterialCategoryExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface MaterialCategoryMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int countByExample(MaterialCategoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int deleteByExample(MaterialCategoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int insert(MaterialCategory record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int insertSelective(MaterialCategory record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
List<MaterialCategory> selectByExample(MaterialCategoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
MaterialCategory selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int updateByExampleSelective(@Param("record") MaterialCategory record, @Param("example") MaterialCategoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int updateByExample(@Param("record") MaterialCategory record, @Param("example") MaterialCategoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int updateByPrimaryKeySelective(MaterialCategory record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int updateByPrimaryKey(MaterialCategory record);
List<MaterialCategory> selectByConditionMaterialCategory(
@Param("name") String name,
@Param("parentId") Integer parentId,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
int countsByMaterialCategory(
@Param("name") String name,
@Param("parentId") Integer parentId);
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.MaterialCategory;
import com.jsh.erp.datasource.entities.MaterialCategoryExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface MaterialCategoryMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int countByExample(MaterialCategoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int deleteByExample(MaterialCategoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int insert(MaterialCategory record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int insertSelective(MaterialCategory record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
List<MaterialCategory> selectByExample(MaterialCategoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
MaterialCategory selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int updateByExampleSelective(@Param("record") MaterialCategory record, @Param("example") MaterialCategoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int updateByExample(@Param("record") MaterialCategory record, @Param("example") MaterialCategoryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int updateByPrimaryKeySelective(MaterialCategory record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_materialcategory
*
* @mbggenerated
*/
int updateByPrimaryKey(MaterialCategory record);
}
\ No newline at end of file
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.MaterialCategory;
import com.jsh.erp.datasource.vo.TreeNode;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* Description
*
* @Author: cjl
* @Date: 2019/2/18 17:23
*/
public interface MaterialCategoryMapperEx {
List<MaterialCategory> selectByConditionMaterialCategory(
@Param("name") String name,
@Param("parentId") Integer parentId,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
int countsByMaterialCategory(
@Param("name") String name,
@Param("parentId") Integer parentId);
List<TreeNode> getNodeTree();
List<TreeNode> getNextNodeTree(@Param("id") Long id);
int addMaterialCategory(MaterialCategory mc);
int batchDeleteMaterialCategoryByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
int editMaterialCategory(MaterialCategory mc);
List<MaterialCategory> getMaterialCategoryBySerialNo(@Param("serialNo") String serialNo);
}
package com.jsh.erp.datasource.vo;
import java.util.List;
/**
* Description
* 树形结构基本元素
* @Author: cjl
* @Date: 2019/2/19 11:27
*/
public class TreeNode {
/**
* id主键
* */
private Long id;
/**
* text显示的文本
* */
private String text;
/**
*state节点状态,'open' 或 'closed',默认:'open'。如果为'closed'的时候,将不自动展开该节点。
* */
private String state="open";
/**
*iconCls 节点图标id
* */
private String iconCls;
/**
* checked 是否被选中
* */
private boolean checked;
/**
*attributes 自定义属性
* */
private String attributes;
/**
* children 子节点
* */
private List<TreeNode> children;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getIconCls() {
return iconCls;
}
public void setIconCls(String iconCls) {
this.iconCls = iconCls;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public String getAttributes() {
return attributes;
}
public void setAttributes(String attributes) {
this.attributes = attributes;
}
public List<TreeNode> getChildren() {
return children;
}
public void setChildren(List<TreeNode> children) {
this.children = children;
}
}
package com.jsh.erp.service.materialCategory;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.MaterialCategory;
import com.jsh.erp.datasource.entities.MaterialCategoryExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.MaterialCategoryMapper;
import com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -12,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
@Service
......@@ -20,6 +28,10 @@ public class MaterialCategoryService {
@Resource
private MaterialCategoryMapper materialCategoryMapper;
@Resource
private MaterialCategoryMapperEx materialCategoryMapperEx;
@Resource
private UserService userService;
public MaterialCategory getMaterialCategory(long id) {
return materialCategoryMapper.selectByPrimaryKey(id);
......@@ -38,11 +50,11 @@ public class MaterialCategoryService {
}
public List<MaterialCategory> select(String name, Integer parentId, int offset, int rows) {
return materialCategoryMapper.selectByConditionMaterialCategory(name, parentId, offset, rows);
return materialCategoryMapperEx.selectByConditionMaterialCategory(name, parentId, offset, rows);
}
public int countMaterialCategory(String name, Integer parentId) {
return materialCategoryMapper.countsByMaterialCategory(name, parentId);
return materialCategoryMapperEx.countsByMaterialCategory(name, parentId);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
......@@ -80,4 +92,105 @@ public class MaterialCategoryService {
example.createCriteria().andIdEqualTo(id);
return materialCategoryMapper.selectByExample(example);
}
/**
* create by: cjl
* description:
*获取商品类别树数据
* create time: 2019/2/19 14:30
* @Param:
* @return java.util.List<com.jsh.erp.datasource.vo.TreeNode>
*/
public List<TreeNode> getMaterialCategoryTree() throws Exception{
return materialCategoryMapperEx.getNodeTree();
}
/**
* create by: cjl
* description:
* 新增商品类别信息
* create time: 2019/2/19 16:30
* @Param: mc
* @return void
*/
public int addMaterialCategory(MaterialCategory mc) throws Exception {
if(mc==null){
return 0;
}
if(mc.getParentid()==null){
//没有给定父级目录的id,默认设置父级目录为根目录
mc.setParentid(BusinessConstants.MATERIAL_CATEGORY_ROOT_ID);
}
//检查商品类型编号是否已存在
checkMaterialCategorySerialNo(mc);
//数据状态新增时默认设置为启用
mc.setStatus(BusinessConstants.MATERIAL_CATEGORY_STATUS_ENABLE);
Date date=new Date();
User userInfo=userService.getCurrentUser();
//创建时间
mc.setCreateTime(date);
//创建人
mc.setCreator(userInfo==null?null:userInfo.getId());
//更新时间
mc.setUpdateTime(date);
//更新人
mc.setUpdater(userInfo==null?null:userInfo.getId());
return materialCategoryMapperEx.addMaterialCategory(mc);
}
public int batchDeleteMaterialCategoryByIds(String ids) throws Exception {
//更新时间
Date updateDate =new Date();
//更新人
User userInfo=userService.getCurrentUser();
Long updater=userInfo==null?null:userInfo.getId();
StringBuffer sb=new StringBuffer();
String strArray[]=ids.split(",");
if(strArray.length<1){
return 0;
}
return materialCategoryMapperEx.batchDeleteMaterialCategoryByIds(updateDate,updater,strArray);
}
public int editMaterialCategory(MaterialCategory mc) {
//检查商品类型编号是否已存在
checkMaterialCategorySerialNo(mc);
//更新时间
mc.setUpdateTime(new Date());
//更新人
User userInfo=userService.getCurrentUser();
mc.setUpdater(userInfo==null?null:userInfo.getId());
return materialCategoryMapperEx.editMaterialCategory(mc);
}
/**
* 根据商品类别编号判断商品类别是否已存在
* */
public void checkMaterialCategorySerialNo(MaterialCategory mc) {
if(mc==null){
return;
}
if(StringUtil.isEmpty(mc.getSerialNo())){
return;
}
//根据商品类别编号查询商品类别
List<MaterialCategory> mList=materialCategoryMapperEx.getMaterialCategoryBySerialNo(mc.getSerialNo());
if(mList==null||mList.size()<1){
//未查询到对应数据,编号可用
return;
}
if(mList.size()>1){
//查询到的数据条数大于1,编号已存在
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_CODE,
ExceptionConstants.MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_MSG);
}
if(mc.getId()==null){
//新增时,编号已存在
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_CODE,
ExceptionConstants.MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_MSG);
}
if(mc.getId()!=mList.get(0).getId()){
//修改时,相同编号,id不同
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_CODE,
ExceptionConstants.MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_MSG);
}
}
}
<?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">
<?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.jsh.erp.datasource.mappers.MaterialCategoryMapper">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.MaterialCategory">
<!--
......@@ -10,6 +10,14 @@
<result column="Name" jdbcType="VARCHAR" property="name" />
<result column="CategoryLevel" jdbcType="SMALLINT" property="categorylevel" />
<result column="ParentId" jdbcType="BIGINT" property="parentid" />
<result column="sort" jdbcType="VARCHAR" property="sort" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="serial_no" jdbcType="VARCHAR" property="serialNo" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="updater" jdbcType="BIGINT" property="updater" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -82,7 +90,8 @@
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
Id, Name, CategoryLevel, ParentId
Id, Name, CategoryLevel, ParentId, sort, status, serial_no, remark, create_time,
creator, update_time, updater
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialCategoryExample" resultMap="BaseResultMap">
<!--
......@@ -136,9 +145,15 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_materialcategory (Id, Name, CategoryLevel,
ParentId)
ParentId, sort, status,
serial_no, remark, create_time,
creator, update_time, updater
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{categorylevel,jdbcType=SMALLINT},
#{parentid,jdbcType=BIGINT})
#{parentid,jdbcType=BIGINT}, #{sort,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{serialNo,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{creator,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{updater,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.MaterialCategory">
<!--
......@@ -159,6 +174,30 @@
<if test="parentid != null">
ParentId,
</if>
<if test="sort != null">
sort,
</if>
<if test="status != null">
status,
</if>
<if test="serialNo != null">
serial_no,
</if>
<if test="remark != null">
remark,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="updater != null">
updater,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -173,6 +212,30 @@
<if test="parentid != null">
#{parentid,jdbcType=BIGINT},
</if>
<if test="sort != null">
#{sort,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="serialNo != null">
#{serialNo,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creator != null">
#{creator,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null">
#{updater,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.MaterialCategoryExample" resultType="java.lang.Integer">
......@@ -204,6 +267,30 @@
<if test="record.parentid != null">
ParentId = #{record.parentid,jdbcType=BIGINT},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.serialNo != null">
serial_no = #{record.serialNo,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.creator != null">
creator = #{record.creator,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updater != null">
updater = #{record.updater,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -218,7 +305,15 @@
set Id = #{record.id,jdbcType=BIGINT},
Name = #{record.name,jdbcType=VARCHAR},
CategoryLevel = #{record.categorylevel,jdbcType=SMALLINT},
ParentId = #{record.parentid,jdbcType=BIGINT}
ParentId = #{record.parentid,jdbcType=BIGINT},
sort = #{record.sort,jdbcType=VARCHAR},
status = #{record.status,jdbcType=VARCHAR},
serial_no = #{record.serialNo,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
creator = #{record.creator,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
updater = #{record.updater,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -239,6 +334,30 @@
<if test="parentid != null">
ParentId = #{parentid,jdbcType=BIGINT},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="serialNo != null">
serial_no = #{serialNo,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creator != null">
creator = #{creator,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null">
updater = #{updater,jdbcType=BIGINT},
</if>
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
......@@ -250,7 +369,15 @@
update jsh_materialcategory
set Name = #{name,jdbcType=VARCHAR},
CategoryLevel = #{categorylevel,jdbcType=SMALLINT},
ParentId = #{parentid,jdbcType=BIGINT}
ParentId = #{parentid,jdbcType=BIGINT},
sort = #{sort,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
serial_no = #{serialNo,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
creator = #{creator,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP},
updater = #{updater,jdbcType=BIGINT}
where Id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?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.jsh.erp.datasource.mappers.MaterialCategoryMapper">
<select id="selectByConditionMaterialCategory" parameterType="com.jsh.erp.datasource.entities.MaterialCategoryExample" resultMap="BaseResultMap">
<mapper namespace="com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx">
<select id="selectByConditionMaterialCategory" parameterType="com.jsh.erp.datasource.entities.MaterialCategoryExample" resultMap="com.jsh.erp.datasource.mappers.MaterialCategoryMapper.BaseResultMap">
select *
FROM jsh_materialcategory
where 1=1
......@@ -29,4 +29,75 @@
</if>
and Id !=1
</select>
<resultMap id="BaseTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNode">
<result column="id" property="id"/>
<result column="name" property="text"/>
<collection column="id" property="children" javaType="java.util.ArrayList"
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
</resultMap>
<resultMap id="NextTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNode">
<result column="id" property="id"/>
<result column="name" property="text"/>
<collection column="id" property="children" javaType="java.util.ArrayList"
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
</resultMap>
<sql id="Base_Column_List">
id, name
</sql>
<select id="getNextNodeTree" resultMap="NextTreeResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM jsh_materialcategory
WHERE ParentId = #{id}
and status !='2'
order by sort asc
</select>
<select id="getNodeTree" resultMap="BaseTreeResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM jsh_materialcategory
WHERE ParentId = -1
and status !='2'
order by sort asc
</select>
<insert id="addMaterialCategory" parameterType="com.jsh.erp.datasource.entities.MaterialCategory"
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into jsh_materialcategory
(Name, CategoryLevel, ParentId, sort,status,serial_no,remark,
create_Time, creator,update_Time, updater)
values
(#{name},#{categorylevel},#{parentid},#{sort},#{status},#{serialNo},#{remark},
#{createTime},#{creator},#{updateTime},#{updater}
)
</insert>
<update id="batchDeleteMaterialCategoryByIds">
update jsh_materialcategory
set update_Time=#{updateTime},updater=#{updater},status='2'
where id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
<update id="editMaterialCategory">
update jsh_materialcategory
set update_Time=#{updateTime},updater=#{updater},
ParentId=#{parentid},sort=#{sort},serial_no=#{serialNo},
name=#{name},remark=#{remark}
where id =#{id}
</update>
<select id="getMaterialCategoryBySerialNo" resultMap="com.jsh.erp.datasource.mappers.MaterialCategoryMapper.BaseResultMap">
select
<include refid="com.jsh.erp.datasource.mappers.MaterialCategoryMapper.Base_Column_List"/>
FROM jsh_materialcategory
where 1=1
and serial_no=#{serialNo}
and status !='2'
</select>
</mapper>
\ No newline at end of file
Supports Markdown
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