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

产品分类

parent c6a99534
......@@ -14,6 +14,8 @@
<modules>
<module>consult-module</module>
<module>consult-module-web</module>
<module>product-classify-module</module>
<module>product-classify-module-web</module>
</modules>
<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
......@@ -106,6 +106,7 @@ orderDeliverGoodsTemplateId=TH3I5prFYPC54M14zFJfgN4gvjx8SpJayctIHmzThwg
#\u670D\u52A1\u5B8C\u6210\u901A\u77E5
serverEndTemplateId=7L1KIroXNxejxotFTzll-dVLdo1xbmqoiAo7UmDKWcc
PRODUCT_CLASSIFY_FATHER_NAME=Ʒ
#\u54C1\u724C\u7533\u8BF7\u6D88\u606F\u6A21\u677F
brandApplyCommTemplateId=82ByH2tkWI1-jlYiWr_-CIihWsgjrvLdFvuO771FwBo
......
......@@ -14,7 +14,7 @@ public class SystemConfig {
try {
// inputStream = SystemConfig.class.newInstance().getClass()
// .getClassLoader().getResourceAsStream("");
p.load(new InputStreamReader(SystemConfig.class.getClassLoader().getResourceAsStream("/common-test.properties"), "utf-8"));
p.load(new InputStreamReader(SystemConfig.class.getClassLoader().getResourceAsStream("/common-test.properties"), "GBK"));
inputStreamRedis = SystemConfig.class.newInstance().getClass()
.getClassLoader().getResourceAsStream("/redis-config-test.properties");
......
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