Commit fb78ecff authored by 卜远杰's avatar 卜远杰

产品详情入库单

parent e52229cc
...@@ -14,6 +14,14 @@ ...@@ -14,6 +14,14 @@
<modules> <modules>
<module>consult-module</module> <module>consult-module</module>
<module>consult-module-web</module> <module>consult-module-web</module>
<module>product-classify-module</module>
<module>product-classify-module-web</module>
<module>product-detail-module</module>
<module>product-detail-module-web</module>
<module>product-into-wareroom-module</module>
<module>product-into-wareroom-module-web</module>
<module>product-module</module>
<module>product-module-web</module>
</modules> </modules>
<dependencies> <dependencies>
......
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product-classify-module-web</artifactId>
<packaging>war</packaging>
<name>product-classify-module-web Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-classify-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>product-classify-module-web</finalName>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product-classify-module</artifactId>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>sys-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.cftech.productclassify.dao;
import com.cftech.productclassify.model.Productclassify;
import com.cftech.core.generic.GenericDao;
import java.util.List;
import java.util.Map;
/**
* 产品分类Mapper
*
* @author Buyj
* @date: 2020-09-22 18:06
*/
public interface ProductclassifyMapper extends GenericDao<Productclassify> {
/**
* 查产品分类
* @param params
* @return
*/
List<Productclassify> fetchTreeByPage(Map<String, Object> params);
}
\ 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.cftech.productclassify.dao.ProductclassifyMapper">
<resultMap id="resultMap" type="com.cftech.productclassify.model.Productclassify">
<id column="id" property="id"/>
<result column="classify_name" property="classifyName"/>
<result column="classify_number" property="classifyNumber"/>
<result column="classify_img" property="classifyImg"/>
<result column="sort" property="sort"/>
<result column="whether_recommend" property="whetherRecommend"/>
<result column="parent_id" property="parentId"/>
<result column="parentName" property="parentName"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</resultMap>
<sql id="sqlWhere">
<if test="conds!=null">
<trim prefix="WHERE" prefixOverrides="AND|OR">
<foreach collection="conds.conds" index="index" item="cond">
${cond.linkType}
<if test="cond.condType == 'EQUAL'">${cond.param} = #{cond.value}</if>
<if test="cond.condType == 'NOTEQUAL'">${cond.param} &lt;&gt; #{cond.value}</if>
<if test="cond.condType == 'GREATEQUAL'">${cond.param} &gt;= #{cond.value}</if>
<if test="cond.condType == 'GREATTHAN'">${cond.param} &gt; #{cond.value}</if>
<if test="cond.condType == 'LESSEQUAL'">${cond.param} &lt;= #{cond.value}</if>
<if test="cond.condType == 'LESSTHAN'">${cond.param} &lt; #{cond.value}</if>
<if test="cond.condType == 'BETWEEN'">${cond.param} BETWEEN #{cond.startValue} AND
#{cond.endValue}
</if>
<if test="cond.condType == 'ISNULL'">${cond.param} IS NULL</if>
<if test="cond.condType == 'NOTNULL'">${cond.param} IS NOT NULL</if>
<if test="cond.condType == 'LIKE'">${cond.param} LIKE #{cond.value}</if>
<if test="cond.condType == 'IN'">${cond.param} IN
<foreach item="item" index="index" collection="cond.value" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</foreach>
</trim>
</if>
</sql>
<sql id="sqlColumns">
id,
classify_name,
classify_number,
classify_img,
sort,
whether_recommend,
parent_id,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<insert id="save" parameterType="com.cftech.productclassify.model.Productclassify" useGeneratedKeys="true"
keyProperty="id">
insert into t_aidea_product_classify
(
<include refid="sqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{classifyName, jdbcType=VARCHAR},
#{classifyNumber, jdbcType=VARCHAR},
#{classifyImg, jdbcType=VARCHAR},
#{sort, jdbcType=VARCHAR},
#{whetherRecommend, jdbcType=VARCHAR},
#{parentId, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select id="fetchTreeByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_product_classify
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_product_classify t
WHERE t.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
t_aidea_product_classify a
LEFT JOIN t_aidea_product_classify b ON b.id = a.parent_id
AND b.del_flag = '0'
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
a.id id,
a.classify_name classifyName,
a.classify_number classifyNumber,
a.classify_img classifyImg,
a.sort sort,
a.whether_recommend whetherRecommend,
a.parent_id parentId,
a.del_flag delFlag,
a.create_time createTime,
a.update_time updateTime,
a.description description,
a.create_by crateBy,
a.update_by updateBy,
b.classify_name parentName
FROM
t_aidea_product_classify a
LEFT JOIN t_aidea_product_classify b ON b.id = a.parent_id
AND b.del_flag = '0'
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<update id="update" parameterType="com.cftech.productclassify.model.Productclassify">
update t_aidea_product_classify
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="classifyName != null">
classify_name = #{classifyName, jdbcType=VARCHAR},
</if>
<if test="classifyNumber != null">
classify_number = #{classifyNumber, jdbcType=VARCHAR},
</if>
<if test="classifyImg != null">
classify_img = #{classifyImg, jdbcType=VARCHAR},
</if>
<if test="sort != null">
sort = #{sort, jdbcType=VARCHAR},
</if>
<if test="whetherRecommend != null">
whether_recommend = #{whetherRecommend, jdbcType=VARCHAR},
</if>
<if test="parentId != null">
parent_id = #{parentId, jdbcType=VARCHAR},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
<update id="delete" parameterType="java.lang.Long">
update t_aidea_product_classify set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
package com.cftech.productclassify.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import org.apache.cxf.jaxws.handler.types.CString;
import java.io.Serializable;
import java.util.Date;
/**
* 产品分类
*
* @author Buyj
* @date: 2020-09-22 18:06
*/
@Data
public class Productclassify implements Serializable {
/* 主键id */
private Long id;
/* 分类名称 */
@ExportConfig(value = "分类名称", width = 100, showLevel = 2)
private String classifyName;
/* 分类编码 */
@ExportConfig(value = "分类编码", width = 100, showLevel = 2)
private String classifyNumber;
/* 分类banner图 */
@ExportConfig(value = "分类banner图", width = 100, showLevel = 1)
private String classifyImg;
/* 序号 */
@ExportConfig(value = "序号", width = 100, showLevel = 2)
private String sort;
/* 是否推荐 */
@ExportConfig(value = "是否推荐(是/否)", width = 200, showLevel = 2)
private String whetherRecommend;
/**
* 父级ID
*/
private String parentId;
/**
* 父级ID 对应的产品分类名称
*/
@ExportConfig(value = "父级编码(不填默认为第一级)", width = 300, showLevel = 2)
private String parentName;
/**
* 父级编码
*/
private String parentNumber;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 备注 */
private String description;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
public Productclassify() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.productclassify.service;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.productclassify.model.Productclassify;
import com.cftech.core.generic.GenericService;
import java.util.List;
import java.util.Map;
/**
* 产品分类Service
*
* @author Buyj
* @date: 2020-09-22 18:06
*/
public interface ProductclassifyService extends GenericService<Productclassify> {
/**
* 查找产品分类
* @param conds
* @param sort
* @param pageNo
* @param pageSize
* @return
*/
List<Productclassify> fetchTreeByPage(Conds conds , Sort sort,int pageNo , int pageSize);
}
package com.cftech.productclassify.service.impl;
import com.cftech.core.sql.Sort;
import com.cftech.productclassify.model.Productclassify;
import com.cftech.productclassify.dao.ProductclassifyMapper;
import com.cftech.productclassify.service.ProductclassifyService;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.sql.Conds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 产品分类ServiceImpl
*
* @author Buyj
* @date: 2020-09-22 18:06
*/
@Service("productclassifyService")
public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassify> implements ProductclassifyService {
@Autowired
@Qualifier("productclassifyMapper")
private ProductclassifyMapper productclassifyMapper;
@Override
public GenericDao<Productclassify> getGenericMapper() {
return productclassifyMapper;
}
@Override
public List<Productclassify> fetchTreeByPage(Conds conds, Sort sort, int pageNo, int pageSize) {
Map<String, Object> params = new HashMap<>();
params.put("conds", conds);
params.put("offset", pageNo > 0 ? pageNo : 0);
params.put("limit", pageSize > 0 ? pageSize : 0);
params.put("sort", sort);
return productclassifyMapper.fetchTreeByPage(params);
}
}
\ No newline at end of file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product-detail-module-web</artifactId>
<packaging>war</packaging>
<name>product-detail-module-web Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-detail-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>product-detail-module-web</finalName>
</build>
</project>
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!--validate css-->
<link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
<!--fileinput css-->
<link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<section class="content-header">
<h1>
产品详情管理
<small>产品详情</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">产品详情</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<!-- general form elements disabled -->
<div class="box box-primary">
<form role="form" id="myForm">
<input name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body">
</div>
<div class="box-footer">
#if($shiro.hasPermission("qy:productDetail:edit"))
<input class="btn btn-primary" id="save" value="保存" type="submit">
#end
<a href="#springUrl('/a/productDetail/list')" class="btn btn-default">取消</a>
</div>
</form>
<!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
$().ready(function () {
Cfapp.init();
recdTypeAdd.init();
});
var recdTypeAdd = function () {
var initForm = function () {
var initFormCtrl = function () {
bindEvent();
};
var bindEvent = function () {
$("#myForm").validate({
rules: {},
messages: {},
submitHandler: function (form) {
$("#save").attr("disabled", true);
$.getJSON("#springUrl('/a/productDetail/formData')", $("#myForm").serialize(), function (returnobj) {
$("#save").attr("disabled", false);
if (returnobj.errorNo == 2) { //保存成功
Cfapp.confirm({
message: "添加成功",
btnoktext: "继续添加",
btncanceltext: "关闭",
success: function () {
location.href = "#springUrl('/a/productDetail/form')";
},
cancel: function () {
location.href = "#springUrl('/a/productDetail/list')";
}
});
} else if (returnobj.errorNo == 0) { //修改成功
Cfapp.alert({
message: "更新成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/productDetail/list')";
}
});
} else {
Cfapp.alert({
message: "创建失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/productDetail/list')";
}
});
}
});
}
})
}
initFormCtrl();
}
return {
//main function to initiate the module
init: function () {
initForm();
}
};
}();
</script>
</body>
<!-- END BODY -->
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product-detail-module</artifactId>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>sys-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.cftech.productdetail.dao;
import com.cftech.productdetail.model.ProductDetail;
import com.cftech.core.generic.GenericDao;
/**
* 产品详情Mapper
*
* @author Buyj
* @date: 2020-09-28 17:08
*/
public interface ProductDetailMapper extends GenericDao<ProductDetail> {
}
\ 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.cftech.productdetail.dao.ProductDetailMapper">
<resultMap id="resultMap" type="com.cftech.productdetail.model.ProductDetail">
<id column="id" property="id"/>
<result column="product_detail_number" property="productDetailNumber"/>
<result column="materiel_number" property="materielNumber"/>
<result column="product_number" property="productNumber"/>
<result column="product_name" property="productName"/>
<result column="product_classify_number" property="productClassifyNumber"/>
<result column="into_wareroom_number" property="intoWareroomNumber"/>
<result column="out_wareroom_number" property="outWareroomNumber"/>
<result column="order_number" property="orderNumber"/>
<result column="logistics_number" property="logisticsNumber"/>
<result column="whether_sell" property="whetherSell"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</resultMap>
<sql id="sqlWhere">
<if test="conds!=null">
<trim prefix="WHERE" prefixOverrides="AND|OR">
<foreach collection="conds.conds" index="index" item="cond">
${cond.linkType}
<if test="cond.condType == 'EQUAL'">${cond.param} = #{cond.value}</if>
<if test="cond.condType == 'NOTEQUAL'">${cond.param} &lt;&gt; #{cond.value}</if>
<if test="cond.condType == 'GREATEQUAL'">${cond.param} &gt;= #{cond.value}</if>
<if test="cond.condType == 'GREATTHAN'">${cond.param} &gt; #{cond.value}</if>
<if test="cond.condType == 'LESSEQUAL'">${cond.param} &lt;= #{cond.value}</if>
<if test="cond.condType == 'LESSTHAN'">${cond.param} &lt; #{cond.value}</if>
<if test="cond.condType == 'BETWEEN'">${cond.param} BETWEEN #{cond.startValue} AND
#{cond.endValue}
</if>
<if test="cond.condType == 'ISNULL'">${cond.param} IS NULL</if>
<if test="cond.condType == 'NOTNULL'">${cond.param} IS NOT NULL</if>
<if test="cond.condType == 'LIKE'">${cond.param} LIKE #{cond.value}</if>
<if test="cond.condType == 'IN'">${cond.param} IN
<foreach item="item" index="index" collection="cond.value" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</foreach>
</trim>
</if>
</sql>
<sql id="sqlColumns">
id,
product_detail_number,
materiel_number,
product_number,
product_name,
product_classify_number,
into_wareroom_number,
out_wareroom_number,
order_number,
logistics_number,
whether_sell,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<insert id="save" parameterType="com.cftech.productdetail.model.ProductDetail" useGeneratedKeys="true"
keyProperty="id">
insert into t_aidea_product_detail
(
<include refid="sqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{productDetailNumber, jdbcType=VARCHAR},
#{materielNumber, jdbcType=VARCHAR},
#{productNumber, jdbcType=VARCHAR},
#{productName, jdbcType=VARCHAR},
#{productClassifyNumber, jdbcType=VARCHAR},
#{intoWareroomNumber, jdbcType=VARCHAR},
#{outWareroomNumber, jdbcType=VARCHAR},
#{orderNumber, jdbcType=VARCHAR},
#{logisticsNumber, jdbcType=VARCHAR},
#{whetherSell, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_product_detail t
WHERE t.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_aidea_product_detail
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_product_detail
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<update id="update" parameterType="com.cftech.productdetail.model.ProductDetail">
update t_aidea_product_detail
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="productDetailNumber != null">
product_detail_number = #{productDetailNumber, jdbcType=VARCHAR},
</if>
<if test="materielNumber != null">
materiel_number = #{materielNumber, jdbcType=VARCHAR},
</if>
<if test="productNumber != null">
product_number = #{productNumber, jdbcType=VARCHAR},
</if>
<if test="productName != null">
product_name = #{productName, jdbcType=VARCHAR},
</if>
<if test="productClassifyNumber != null">
product_classify_number = #{productClassifyNumber, jdbcType=VARCHAR},
</if>
<if test="intoWareroomNumber != null">
into_wareroom_number = #{intoWareroomNumber, jdbcType=VARCHAR},
</if>
<if test="outWareroomNumber != null">
out_wareroom_number = #{outWareroomNumber, jdbcType=VARCHAR},
</if>
<if test="orderNumber != null">
order_number = #{orderNumber, jdbcType=VARCHAR},
</if>
<if test="logisticsNumber != null">
logistics_number = #{logisticsNumber, jdbcType=VARCHAR},
</if>
<if test="whetherSell != null">
whether_sell = #{whetherSell, jdbcType=VARCHAR},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
<update id="delete" parameterType="java.lang.Long">
update t_aidea_product_detail set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
package com.cftech.productdetail.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 产品详情
*
* @author Buyj
* @date: 2020-09-28 17:08
*/
@Data
public class ProductDetail implements Serializable {
/* 主键id */
private Long id;
/* 产品详情编码 */
@ExportConfig(value = "产品详情编码", width = 150, showLevel = 1)
private String productDetailNumber;
/* 物料编码 */
@ExportConfig(value = "物料编码", width = 100, showLevel = 1)
private String materielNumber;
/* 产品编码 */
@ExportConfig(value = "产品编码", width = 100, showLevel = 1)
private String productNumber;
/* 产品名称 */
@ExportConfig(value = "产品名称", width = 100, showLevel = 1)
private String productName;
/* 产品分类编码 */
@ExportConfig(value = "产品分类编码", width = 150, showLevel = 1)
private String productClassifyNumber;
/* 入库编码 */
@ExportConfig(value = "入库编码", width = 100, showLevel = 1)
private String intoWareroomNumber;
/* 出库编码 */
@ExportConfig(value = "出库编码", width = 100, showLevel = 1)
private String outWareroomNumber;
/* 订单编码 */
@ExportConfig(value = "订单编码", width = 100, showLevel = 1)
private String orderNumber;
/* 物流编码 */
@ExportConfig(value = "物流编码", width = 100, showLevel = 1)
private String logisticsNumber;
/* 是否出售 */
@ExportConfig(value = "是否出售", width = 100, showLevel = 1)
private String whetherSell;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 备注 */
private String description;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
public ProductDetail() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.productdetail.service;
import com.cftech.productdetail.model.ProductDetail;
import com.cftech.core.generic.GenericService;
/**
* 产品详情Service
*
* @author Buyj
* @date: 2020-09-28 17:08
*/
public interface ProductDetailService extends GenericService<ProductDetail> {
}
package com.cftech.productdetail.service.impl;
import com.cftech.productdetail.model.ProductDetail;
import com.cftech.productdetail.dao.ProductDetailMapper;
import com.cftech.productdetail.service.ProductDetailService;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.sql.Conds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
/**
* 产品详情ServiceImpl
*
* @author Buyj
* @date: 2020-09-28 17:08
*/
@Service("productDetailService")
public class ProductDetailServiceImpl extends GenericServiceImpl<ProductDetail> implements ProductDetailService {
@Autowired
@Qualifier("productDetailMapper")
private ProductDetailMapper productDetailMapper;
@Override
public GenericDao<ProductDetail> getGenericMapper() {
return productDetailMapper;
}
}
\ No newline at end of file
package com.cftech.productdetail.web;
import com.alibaba.fastjson.JSONObject;
import com.cftech.productdetail.model.ProductDetail;
import com.cftech.productdetail.service.ProductDetailService;
import com.cftech.core.poi.ExcelKit;
import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.sys.security.PermissionSign;
import com.cftech.sys.security.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* 产品详情Controller
* <p>
* 权限字符串说明:
* 查看:public static final String PRODUCTDETAIL_VIEW = "qy:productDetail:view"
* 查看:public static final String PRODUCTDETAIL_EDIT = "qy:productDetail:edit"
*
* @author Buyj
* @date: 2020-09-28 17:08
*/
@Slf4j
@Controller
@RequestMapping("/a/productDetail")
public class ProductDetailController {
public static final String PRODUCTDETAIL_VIEW = "qy:productDetail:view";
public static final String PRODUCTDETAIL_EDIT = "qy:productDetail:edit";
@Autowired
private ProductDetailService productDetailService;
//列表页面
@RequiresPermissions(value = PRODUCTDETAIL_VIEW)
@RequestMapping("/list")
public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
return "productDetail/productDetaillist";
}
//编辑页面(新增、修改)
@RequiresPermissions(value = PRODUCTDETAIL_VIEW)
@RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
ProductDetail productDetail = productDetailService.fetchById(id);
model.addAttribute("data", productDetail);
}
return "productDetail/productDetailform";
}
//提交数据(新增、修改)
@RequiresPermissions(value = PRODUCTDETAIL_EDIT)
@RequestMapping("/formData")
@ResponseBody
public JSONObject formData(ProductDetail productDetail, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject();
try {
if (productDetail != null && productDetail.getId() != null) {
productDetail.setUpdateBy(UserUtils.getUser().getId());
productDetailService.update(productDetail);
rtnJson.put("errorNo", 0);
} else {
productDetail.setAccountsId(accountsId);
productDetail.setDelFlag(false);
productDetail.setAccountsId(UserUtils.getmpaccounts(request));
productDetail.setCreateBy(UserUtils.getUser().getId());
productDetail.setUpdateBy(UserUtils.getUser().getId());
productDetailService.save(productDetail);
rtnJson.put("errorNo", 2);
}
} catch (Exception e) {
rtnJson.put("errorNo", 1);
}
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = PRODUCTDETAIL_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, ProductDetail productDetail, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0);
conds.equal("accounts_id", accountsId);
if(!StringUtils.isEmpty(productDetail.getProductName())){
conds.equal("product_name",productDetail.getProductName());
}
Sort sort = new Sort("create_time", OrderType.DESC);
List<ProductDetail> list = productDetailService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = productDetailService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据
@RequiresPermissions(value = PRODUCTDETAIL_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
productDetailService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = PRODUCTDETAIL_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
Long accountId = UserUtils.getmpaccounts(request);
Sort sort = new Sort("create_time", OrderType.ASC);
Conds conds = new Conds();
conds.equal("del_flag", 0);
conds.equal("accounts_id", accountId);
List<ProductDetail> list = productDetailService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(ProductDetail.class, response).toExcel(list, "产品详情信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = PRODUCTDETAIL_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(ProductDetail.class, response).toExcel(null, "产品详情信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = PRODUCTDETAIL_EDIT)
public String importExcel(HttpServletRequest request, MultipartFile file, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
if (file == null) {
return list(request, model);
}
// 构造临时路径来存储上传的文件
String uploadPath = System.getProperty("java.io.tmpdir");
File uploadDir = new File(uploadPath);
if (!uploadDir.exists()) {
uploadDir.mkdir();
}
String fileName = file.getOriginalFilename();
String filePath = uploadPath + File.separator + fileName;
File storeFile = new File(filePath);
try {
file.transferTo(storeFile);
ExcelKit.$Import().setEmptyCellValue("").readExcel(storeFile, rowData -> {
if (!StringUtils.isEmpty(rowData.get(0))) {
ProductDetail productDetail = new ProductDetail();
productDetail.setAccountsId(accountId);
productDetailService.save(productDetail);
}
});
} catch (IOException e) {
log.error(e.getMessage());
}
return list(request, model);
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product-into-wareroom-module-web</artifactId>
<packaging>war</packaging>
<name>product-into-wareroom-module-web Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-into-wareroom-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>product-into-wareroom-module-web</finalName>
</build>
</project>
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!--validate css-->
<link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
<!--fileinput css-->
<link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<section class="content-header">
<h1>
产品入库单管理
<small>产品入库单</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">产品入库单</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<!-- general form elements disabled -->
<div class="box box-primary">
<form role="form" id="myForm">
<input name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body">
</div>
<div class="box-footer">
#if($shiro.hasPermission("qy:productIntoWareroom:edit"))
<input class="btn btn-primary" id="save" value="保存" type="submit">
#end
<a href="#springUrl('/a/productIntoWareroom/list')" class="btn btn-default">取消</a>
</div>
</form>
<!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
$().ready(function () {
Cfapp.init();
recdTypeAdd.init();
});
var recdTypeAdd = function () {
var initForm = function () {
var initFormCtrl = function () {
bindEvent();
};
var bindEvent = function () {
$("#myForm").validate({
rules: {},
messages: {},
submitHandler: function (form) {
$("#save").attr("disabled", true);
$.getJSON("#springUrl('/a/productIntoWareroom/formData')", $("#myForm").serialize(), function (returnobj) {
$("#save").attr("disabled", false);
if (returnobj.errorNo == 2) { //保存成功
Cfapp.confirm({
message: "添加成功",
btnoktext: "继续添加",
btncanceltext: "关闭",
success: function () {
location.href = "#springUrl('/a/productIntoWareroom/form')";
},
cancel: function () {
location.href = "#springUrl('/a/productIntoWareroom/list')";
}
});
} else if (returnobj.errorNo == 0) { //修改成功
Cfapp.alert({
message: "更新成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/productIntoWareroom/list')";
}
});
} else {
Cfapp.alert({
message: "创建失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/productIntoWareroom/list')";
}
});
}
});
}
})
}
initFormCtrl();
}
return {
//main function to initiate the module
init: function () {
initForm();
}
};
}();
</script>
</body>
<!-- END BODY -->
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product-into-wareroom-module</artifactId>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>sys-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.cftech.productintowareroom.dao;
import com.cftech.productintowareroom.model.ProductIntoWareroom;
import com.cftech.core.generic.GenericDao;
/**
* 产品入库单Mapper
*
* @author Buyj
* @date: 2020-09-27 17:38
*/
public interface ProductIntoWareroomMapper extends GenericDao<ProductIntoWareroom> {
}
\ 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.cftech.productintowareroom.dao.ProductIntoWareroomMapper">
<resultMap id="resultMap" type="com.cftech.productintowareroom.model.ProductIntoWareroom">
<id column="id" property="id"/>
<result column="into_wareroom_number" property="intoWareroomNumber"/>
<result column="out_wareroom_number" property="outWareroomNumber"/>
<result column="product_sku_number" property="productSkuNumber"/>
<result column="product_number" property="productNumber"/>
<result column="product_name" property="productName"/>
<result column="product_amount" property="productAmount"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
<result column="product_classify_number" property="productClassifyNumber"/>
</resultMap>
<sql id="sqlWhere">
<if test="conds!=null">
<trim prefix="WHERE" prefixOverrides="AND|OR">
<foreach collection="conds.conds" index="index" item="cond">
${cond.linkType}
<if test="cond.condType == 'EQUAL'">${cond.param} = #{cond.value}</if>
<if test="cond.condType == 'NOTEQUAL'">${cond.param} &lt;&gt; #{cond.value}</if>
<if test="cond.condType == 'GREATEQUAL'">${cond.param} &gt;= #{cond.value}</if>
<if test="cond.condType == 'GREATTHAN'">${cond.param} &gt; #{cond.value}</if>
<if test="cond.condType == 'LESSEQUAL'">${cond.param} &lt;= #{cond.value}</if>
<if test="cond.condType == 'LESSTHAN'">${cond.param} &lt; #{cond.value}</if>
<if test="cond.condType == 'BETWEEN'">${cond.param} BETWEEN #{cond.startValue} AND
#{cond.endValue}
</if>
<if test="cond.condType == 'ISNULL'">${cond.param} IS NULL</if>
<if test="cond.condType == 'NOTNULL'">${cond.param} IS NOT NULL</if>
<if test="cond.condType == 'LIKE'">${cond.param} LIKE #{cond.value}</if>
<if test="cond.condType == 'IN'">${cond.param} IN
<foreach item="item" index="index" collection="cond.value" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</foreach>
</trim>
</if>
</sql>
<sql id="sqlColumns">
id,
into_wareroom_number,
out_wareroom_number,
product_sku_number,
product_number,
product_name,
product_amount,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by,
product_classify_number
</sql>
<insert id="save" parameterType="com.cftech.productintowareroom.model.ProductIntoWareroom" useGeneratedKeys="true"
keyProperty="id">
insert into t_aidea_product_into_wareroom
(
<include refid="sqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{intoWareroomNumber, jdbcType=VARCHAR},
#{outWareroomNumber, jdbcType=VARCHAR},
#{productSkuNumber, jdbcType=VARCHAR},
#{productNumber, jdbcType=VARCHAR},
#{productName, jdbcType=VARCHAR},
#{productAmount, jdbcType=BIGINT},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT},
#{productClassifyNumber,jdbcType=VARCHAR}
)
</insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_product_into_wareroom t
WHERE t.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_aidea_product_into_wareroom
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_product_into_wareroom
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<update id="update" parameterType="com.cftech.productintowareroom.model.ProductIntoWareroom">
update t_aidea_product_into_wareroom
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="intoWareroomNumber != null">
into_wareroom_number = #{intoWareroomNumber, jdbcType=VARCHAR},
</if>
<if test="outWareroomNumber != null">
out_wareroom_number = #{outWareroomNumber, jdbcType=VARCHAR},
</if>
<if test="productSkuNumber != null">
product_sku_number = #{productSkuNumber, jdbcType=VARCHAR},
</if>
<if test="productNumber != null">
product_number = #{productNumber, jdbcType=VARCHAR},
</if>
<if test="productName != null">
product_name = #{productName, jdbcType=VARCHAR},
</if>
<if test="productAmount != null">
product_amount = #{productAmount, jdbcType=BIGINT},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
<update id="delete" parameterType="java.lang.Long">
update t_aidea_product_into_wareroom set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
package com.cftech.productintowareroom.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 产品入库单
*
* @author Buyj
* @date: 2020-09-27 17:38
*/
@Data
public class ProductIntoWareroom implements Serializable {
/* 主键id */
private Long id;
/* 入库编码 */
@ExportConfig(value = "入库编码", width = 150, showLevel = 1)
private String intoWareroomNumber;
/* 出库编码 */
private String outWareroomNumber;
/* 商品SKU码 */
@ExportConfig(value = "商品SKU码", width = 150, showLevel = 1)
private String productSkuNumber;
/* 商品编码 */
@ExportConfig(value = "商品编码", width = 150, showLevel = 1)
private String productNumber;
/* 商品名称 */
@ExportConfig(value = "商品名称", width = 150, showLevel = 1)
private String productName;
/* 商品数量 */
@ExportConfig(value = "商品数量", width = 150, showLevel = 1)
private Long productAmount;
/**
* 商品分类编码
*/
@ExportConfig(value = "商品分类编码", width = 150, showLevel = 1)
private String productClassifyNumber;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 备注 */
private String description;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
public ProductIntoWareroom() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.productintowareroom.service;
import com.cftech.productintowareroom.model.ProductIntoWareroom;
import com.cftech.core.generic.GenericService;
/**
* 产品入库单Service
*
* @author Buyj
* @date: 2020-09-27 17:38
*/
public interface ProductIntoWareroomService extends GenericService<ProductIntoWareroom> {
}
package com.cftech.productintowareroom.service.impl;
import com.cftech.productintowareroom.model.ProductIntoWareroom;
import com.cftech.productintowareroom.dao.ProductIntoWareroomMapper;
import com.cftech.productintowareroom.service.ProductIntoWareroomService;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.sql.Conds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
/**
* 产品入库单ServiceImpl
*
* @author Buyj
* @date: 2020-09-27 17:38
*/
@Service("productIntoWareroomService")
public class ProductIntoWareroomServiceImpl extends GenericServiceImpl<ProductIntoWareroom> implements ProductIntoWareroomService {
@Autowired
@Qualifier("productIntoWareroomMapper")
private ProductIntoWareroomMapper productIntoWareroomMapper;
@Override
public GenericDao<ProductIntoWareroom> getGenericMapper() {
return productIntoWareroomMapper;
}
}
\ No newline at end of file
package com.cftech.productintowareroom.web;
import com.alibaba.fastjson.JSONObject;
import com.cftech.productintowareroom.model.ProductIntoWareroom;
import com.cftech.productintowareroom.service.ProductIntoWareroomService;
import com.cftech.core.poi.ExcelKit;
import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.sys.security.PermissionSign;
import com.cftech.sys.security.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* 产品入库单Controller
* <p>
* 权限字符串说明:
* 查看:public static final String PRODUCTINTOWAREROOM_VIEW = "qy:productIntoWareroom:view"
* 查看:public static final String PRODUCTINTOWAREROOM_EDIT = "qy:productIntoWareroom:edit"
*
* @author Buyj
* @date: 2020-09-27 17:38
*/
@Slf4j
@Controller
@RequestMapping("/a/productIntoWareroom")
public class ProductIntoWareroomController {
public static final String PRODUCTINTOWAREROOM_VIEW = "qy:productIntoWareroom:view";
public static final String PRODUCTINTOWAREROOM_EDIT = "qy:productIntoWareroom:edit";
@Autowired
private ProductIntoWareroomService productIntoWareroomService;
//列表页面
@RequiresPermissions(value = PRODUCTINTOWAREROOM_VIEW)
@RequestMapping("/list")
public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
return "productIntoWareroom/productIntoWareroomlist";
}
//编辑页面(新增、修改)
@RequiresPermissions(value = PRODUCTINTOWAREROOM_VIEW)
@RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
ProductIntoWareroom productIntoWareroom = productIntoWareroomService.fetchById(id);
model.addAttribute("data", productIntoWareroom);
}
return "productIntoWareroom/productIntoWareroomform";
}
//提交数据(新增、修改)
@RequiresPermissions(value = PRODUCTINTOWAREROOM_EDIT)
@RequestMapping("/formData")
@ResponseBody
public JSONObject formData(ProductIntoWareroom productIntoWareroom, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject();
try {
if (productIntoWareroom != null && productIntoWareroom.getId() != null) {
productIntoWareroom.setUpdateBy(UserUtils.getUser().getId());
productIntoWareroomService.update(productIntoWareroom);
rtnJson.put("errorNo", 0);
} else {
productIntoWareroom.setAccountsId(accountsId);
productIntoWareroom.setDelFlag(false);
productIntoWareroom.setAccountsId(UserUtils.getmpaccounts(request));
productIntoWareroom.setCreateBy(UserUtils.getUser().getId());
productIntoWareroom.setUpdateBy(UserUtils.getUser().getId());
productIntoWareroomService.save(productIntoWareroom);
rtnJson.put("errorNo", 2);
}
} catch (Exception e) {
rtnJson.put("errorNo", 1);
}
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = PRODUCTINTOWAREROOM_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, ProductIntoWareroom productIntoWareroom, HttpServletRequest request,String startTime) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0);
conds.equal("accounts_id", accountsId);
if(!StringUtils.isEmpty(productIntoWareroom.getIntoWareroomNumber())){
conds.like("into_wareroom_number",productIntoWareroom.getIntoWareroomNumber());
}
if(!StringUtils.isEmpty(startTime)){
conds.equal("DATE_FORMAT(create_time,'%Y-%m-%d')",startTime);
}
Sort sort = new Sort("create_time", OrderType.DESC);
List<ProductIntoWareroom> list = productIntoWareroomService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = productIntoWareroomService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据
@RequiresPermissions(value = PRODUCTINTOWAREROOM_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
productIntoWareroomService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = PRODUCTINTOWAREROOM_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
Long accountId = UserUtils.getmpaccounts(request);
Sort sort = new Sort("create_time", OrderType.ASC);
Conds conds = new Conds();
conds.equal("del_flag", 0);
conds.equal("accounts_id", accountId);
List<ProductIntoWareroom> list = productIntoWareroomService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(ProductIntoWareroom.class, response).toExcel(list, "产品入库单信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = PRODUCTINTOWAREROOM_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(ProductIntoWareroom.class, response).toExcel(null, "产品入库单信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = PRODUCTINTOWAREROOM_EDIT)
public String importExcel(HttpServletRequest request, MultipartFile file, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
if (file == null) {
return list(request, model);
}
// 构造临时路径来存储上传的文件
String uploadPath = System.getProperty("java.io.tmpdir");
File uploadDir = new File(uploadPath);
if (!uploadDir.exists()) {
uploadDir.mkdir();
}
String fileName = file.getOriginalFilename();
String filePath = uploadPath + File.separator + fileName;
File storeFile = new File(filePath);
try {
file.transferTo(storeFile);
ExcelKit.$Import().setEmptyCellValue("").readExcel(storeFile, rowData -> {
if (!StringUtils.isEmpty(rowData.get(0))) {
ProductIntoWareroom productIntoWareroom = new ProductIntoWareroom();
productIntoWareroom.setAccountsId(accountId);
productIntoWareroomService.save(productIntoWareroom);
}
});
} catch (IOException e) {
log.error(e.getMessage());
}
return list(request, model);
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product-module-web</artifactId>
<packaging>war</packaging>
<name>product-module-web Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>product-module-web</finalName>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product-module</artifactId>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>sys-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-classify-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-into-wareroom-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-detail-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.cftech.product.dao;
import com.cftech.product.model.Product;
import com.cftech.core.generic.GenericDao;
/**
* 产品Mapper
*
* @author Buyj
* @date: 2020-09-24 15:07
*/
public interface ProductMapper extends GenericDao<Product> {
}
\ No newline at end of file
package com.cftech.product.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 产品
*
* @author Buyj
* @date: 2020-09-24 15:07
*/
@Data
public class Product implements Serializable {
/**
* 主键id
*/
private Long id;
/**
* 产品分类ID
*/
private String classifyId;
/**
* 产品分类编码
*/
@ExportConfig(value = "产品分类编码",width = 150 ,showLevel = 2)
private String classifyNumber;
/**
* 产品分类名称
*/
@ExportConfig(value = "产品分类名称", width = 150, showLevel = 1)
private String classifyName;
/**
* 产品编码
*/
@ExportConfig(value = "产品编码", width = 100)
private String productNumber;
/**
* 产品名称
*/
@ExportConfig(value = "产品名称", width = 100)
private String productName;
/**
* 通用名
*/
@ExportConfig(value = "通用名", width = 100)
private String commonName;
/**
*剂型
*/
@ExportConfig(value = "剂型", width = 100)
private String dosagaFrom;
/**
*规格
*/
@ExportConfig(value = "规格", width = 100)
private String format;
/**
*批准文号
*/
@ExportConfig(value = "批准文号",width = 100)
private String approveNumber;
/**
*生产企业
*/
@ExportConfig(value = "生产企业", width = 100)
private String manufacturer;
/**
*推荐计量
*/
@ExportConfig(value = "推荐计量", width = 100)
private String recommendMeasure;
/**
* 药品简介
*/
@ExportConfig(value = "药品简介",width = 150)
private String description;
/**
*温馨提示
*/
@ExportConfig(value = "温馨提示", width = 100)
private String tips;
/**
* 服用类型
*/
@ExportConfig(value = "服用类型(天/周/月)", width = 200)
private String takeType;
/**
*服用频率
*/
@ExportConfig(value = "服用频率", width = 100)
private String takeFrequency;
/**
*服用次数
*/
@ExportConfig(value = "服用数量", width = 100)
private String takeAmount;
/**
*库存
*/
@ExportConfig(value = "库存", width = 100)
private Long stock;
/**
*价格
*/
@ExportConfig(value = "价格", width = 100)
private Double price;
/**
* 是否为处方药
*/
@ExportConfig(value = "是否为处方药(是/否)",width = 200)
private String isRs;
/**
* 产品详情图
*/
private String productImgDetail;
/**
*产品图片
*/
private String productImg;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
public Product() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.product.service;
import com.cftech.product.model.Product;
import com.cftech.core.generic.GenericService;
/**
* 产品Service
*
* @author Buyj
* @date: 2020-09-24 15:07
*/
public interface ProductService extends GenericService<Product> {
/**
* 商品导入
* @param product
*/
boolean saveProduct(Product product);
}
...@@ -238,6 +238,30 @@ ...@@ -238,6 +238,30 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>war</type> <type>war</type>
</dependency> </dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-classify-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-into-wareroom-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-detail-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<!--<dependency> <!--<dependency>
<groupId>com.cftech</groupId> <groupId>com.cftech</groupId>
<artifactId>fours-job-module</artifactId> <artifactId>fours-job-module</artifactId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment