编号:ZSSAC-163 描述:我的购买商品与安装包后台
This commit is contained in:
parent
8a0e6b5a34
commit
161a7b8af0
@ -60,7 +60,13 @@
|
||||
<groupId>com.smarterFramework</groupId>
|
||||
<artifactId>sf-file</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.smarterFramework</groupId>
|
||||
<artifactId>sf-order</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
113
sf-admin/src/main/resources/mapper/deploy/SysApkInfoMapper.xml
Normal file
113
sf-admin/src/main/resources/mapper/deploy/SysApkInfoMapper.xml
Normal file
@ -0,0 +1,113 @@
|
||||
<?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.sf.deploy.mapper.SysApkInfoMapper">
|
||||
|
||||
<resultMap type="SysApkInfo" id="SysApkInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="uploadingType" column="uploading_type" />
|
||||
<result property="sysApkName" column="sys_apk_name" />
|
||||
<result property="version" column="version" />
|
||||
<result property="sysApk" column="sys_apk" />
|
||||
<result property="sysApkSize" column="sys_apk_size" />
|
||||
<result property="sysType" column="sys_type" />
|
||||
<result property="uploadingStatus" column="uploading_status" />
|
||||
<result property="uploadingLogId" column="uploading_log_id" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
<result property="created" column="created" />
|
||||
<result property="modified" column="modified" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysApkInfoVo">
|
||||
select id, uploading_type, sys_apk_name, version, sys_apk, sys_apk_size, sys_type, uploading_status, uploading_log_id, order_num, is_delete, created, modified, create_time, update_time from SYS_APK_INFO
|
||||
</sql>
|
||||
|
||||
<select id="selectSysApkInfoList" parameterType="SysApkInfo" resultMap="SysApkInfoResult">
|
||||
<include refid="selectSysApkInfoVo"/>
|
||||
<where>
|
||||
<if test="uploadingType != null and uploadingType != ''"> and uploading_type = #{uploadingType}</if>
|
||||
<if test="sysApkName != null and sysApkName != ''"> and sys_apk_name like concat('%', #{sysApkName}, '%')</if>
|
||||
<if test="version != null and version != ''"> and version = #{version}</if>
|
||||
<if test="sysType != null and sysType != ''"> and sys_type = #{sysType}</if>
|
||||
<if test="uploadingStatus != null "> and uploading_status = #{uploadingStatus}</if>
|
||||
<if test="created != null and created != ''"> and created = #{created}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysApkInfoById" parameterType="Long" resultMap="SysApkInfoResult">
|
||||
<include refid="selectSysApkInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysApkInfo" parameterType="SysApkInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into SYS_APK_INFO
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="uploadingType != null and uploadingType != ''">uploading_type,</if>
|
||||
<if test="sysApkName != null and sysApkName != ''">sys_apk_name,</if>
|
||||
<if test="version != null and version != ''">version,</if>
|
||||
<if test="sysApk != null">sys_apk,</if>
|
||||
<if test="sysApkSize != null">sys_apk_size,</if>
|
||||
<if test="sysType != null and sysType != ''">sys_type,</if>
|
||||
<if test="uploadingStatus != null">uploading_status,</if>
|
||||
<if test="uploadingLogId != null">uploading_log_id,</if>
|
||||
<if test="orderNum != null">order_num,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
<if test="created != null">created,</if>
|
||||
<if test="modified != null">modified,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="uploadingType != null and uploadingType != ''">#{uploadingType},</if>
|
||||
<if test="sysApkName != null and sysApkName != ''">#{sysApkName},</if>
|
||||
<if test="version != null and version != ''">#{version},</if>
|
||||
<if test="sysApk != null">#{sysApk},</if>
|
||||
<if test="sysApkSize != null">#{sysApkSize},</if>
|
||||
<if test="sysType != null and sysType != ''">#{sysType},</if>
|
||||
<if test="uploadingStatus != null">#{uploadingStatus},</if>
|
||||
<if test="uploadingLogId != null">#{uploadingLogId},</if>
|
||||
<if test="orderNum != null">#{orderNum},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
<if test="created != null">#{created},</if>
|
||||
<if test="modified != null">#{modified},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysApkInfo" parameterType="SysApkInfo">
|
||||
update SYS_APK_INFO
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="uploadingType != null and uploadingType != ''">uploading_type = #{uploadingType},</if>
|
||||
<if test="sysApkName != null and sysApkName != ''">sys_apk_name = #{sysApkName},</if>
|
||||
<if test="version != null and version != ''">version = #{version},</if>
|
||||
<if test="sysApk != null">sys_apk = #{sysApk},</if>
|
||||
<if test="sysApkSize != null">sys_apk_size = #{sysApkSize},</if>
|
||||
<if test="sysType != null and sysType != ''">sys_type = #{sysType},</if>
|
||||
<if test="uploadingStatus != null">uploading_status = #{uploadingStatus},</if>
|
||||
<if test="uploadingLogId != null">uploading_log_id = #{uploadingLogId},</if>
|
||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="created != null">created = #{created},</if>
|
||||
<if test="modified != null">modified = #{modified},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysApkInfoById" parameterType="Long">
|
||||
delete from SYS_APK_INFO where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysApkInfoByIds" parameterType="String">
|
||||
delete from SYS_APK_INFO where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
118
sf-admin/src/main/resources/mapper/goods/GoodsMessagesMapper.xml
Normal file
118
sf-admin/src/main/resources/mapper/goods/GoodsMessagesMapper.xml
Normal file
@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sf.goods.mapper.GoodsMessagesMapper">
|
||||
|
||||
<resultMap type="GoodsMessages" id="GoodsMessagesResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="goodsCode" column="goods_code" />
|
||||
<result property="stockId" column="stock_id" />
|
||||
<result property="reviewStatus" column="review_status" />
|
||||
<result property="productTitle" column="product_title" />
|
||||
<result property="productPicture" column="product_picture" />
|
||||
<result property="originalPrice" column="original_price" />
|
||||
<result property="productDesc" column="product_desc" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
<result property="created" column="created" />
|
||||
<result property="modified" column="modified" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="goodsType" column="goods_type" />
|
||||
<result property="goodsSpec" column="goods_spec" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGoodsMessagesVo">
|
||||
select id, goods_code, stock_id, review_status, product_title, product_picture, original_price, product_desc, order_num, is_delete, created, modified, create_time, update_time, goods_type, goods_spec from GOODS_MESSAGES
|
||||
</sql>
|
||||
|
||||
<select id="selectGoodsMessagesList" parameterType="GoodsMessages" resultMap="GoodsMessagesResult">
|
||||
<include refid="selectGoodsMessagesVo"/>
|
||||
<where>
|
||||
<if test="goodsCode != null and goodsCode != ''"> and goods_code = #{goodsCode}</if>
|
||||
<if test="productTitle != null and productTitle != ''"> and product_title like concat('%', #{productTitle}, '%')</if>
|
||||
<if test="goodsType != null and goodsType != ''"> and goods_type = #{goodsType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectGoodsMessagesById" parameterType="Long" resultMap="GoodsMessagesResult">
|
||||
<include refid="selectGoodsMessagesVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectGoodsMessagesByCode" parameterType="java.lang.String" resultMap="GoodsMessagesResult">
|
||||
<include refid="selectGoodsMessagesVo"/>
|
||||
where goods_code = #{code}
|
||||
</select>
|
||||
|
||||
<insert id="insertGoodsMessages" parameterType="GoodsMessages" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into GOODS_MESSAGES
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="goodsCode != null and goodsCode != ''">goods_code,</if>
|
||||
<if test="stockId != null">stock_id,</if>
|
||||
<if test="reviewStatus != null">review_status,</if>
|
||||
<if test="productTitle != null and productTitle != ''">product_title,</if>
|
||||
<if test="productPicture != null and productPicture != ''">product_picture,</if>
|
||||
<if test="originalPrice != null">original_price,</if>
|
||||
<if test="productDesc != null">product_desc,</if>
|
||||
<if test="orderNum != null">order_num,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
<if test="created != null">created,</if>
|
||||
<if test="modified != null">modified,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="goodsType != null and goodsType != ''">goods_type,</if>
|
||||
<if test="goodsSpec != null and goodsSpec != ''">goods_spec,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="goodsCode != null and goodsCode != ''">#{goodsCode},</if>
|
||||
<if test="stockId != null">#{stockId},</if>
|
||||
<if test="reviewStatus != null">#{reviewStatus},</if>
|
||||
<if test="productTitle != null and productTitle != ''">#{productTitle},</if>
|
||||
<if test="productPicture != null and productPicture != ''">#{productPicture},</if>
|
||||
<if test="originalPrice != null">#{originalPrice},</if>
|
||||
<if test="productDesc != null">#{productDesc},</if>
|
||||
<if test="orderNum != null">#{orderNum},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
<if test="created != null">#{created},</if>
|
||||
<if test="modified != null">#{modified},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="goodsType != null and goodsType != ''">#{goodsType},</if>
|
||||
<if test="goodsSpec != null and goodsSpec != ''">#{goodsSpec},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateGoodsMessages" parameterType="GoodsMessages">
|
||||
update GOODS_MESSAGES
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="goodsCode != null and goodsCode != ''">goods_code = #{goodsCode},</if>
|
||||
<if test="stockId != null">stock_id = #{stockId},</if>
|
||||
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
||||
<if test="productTitle != null and productTitle != ''">product_title = #{productTitle},</if>
|
||||
<if test="productPicture != null and productPicture != ''">product_picture = #{productPicture},</if>
|
||||
<if test="originalPrice != null">original_price = #{originalPrice},</if>
|
||||
<if test="productDesc != null">product_desc = #{productDesc},</if>
|
||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="created != null">created = #{created},</if>
|
||||
<if test="modified != null">modified = #{modified},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="goodsType != null and goodsType != ''">goods_type = #{goodsType},</if>
|
||||
<if test="goodsSpec != null and goodsSpec != ''">goods_spec = #{goodsSpec},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteGoodsMessagesById" parameterType="Long">
|
||||
delete from GOODS_MESSAGES where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteGoodsMessagesByIds" parameterType="String">
|
||||
delete from GOODS_MESSAGES where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,87 @@
|
||||
<?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.sf.index.mapper.ApplyListInfoMapper">
|
||||
|
||||
<resultMap type="ApplyListInfo" id="ApplyListInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="appName" column="app_name" />
|
||||
<result property="appDesc" column="app_desc" />
|
||||
<result property="picture" column="picture" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
<result property="created" column="created" />
|
||||
<result property="modified" column="modified" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectApplyListInfoVo">
|
||||
select id, app_name, app_desc, picture, order_num, is_delete, created, modified, create_time, update_time from APPLY_LIST_INFO
|
||||
</sql>
|
||||
|
||||
<select id="selectApplyListInfoList" parameterType="ApplyListInfo" resultMap="ApplyListInfoResult">
|
||||
<include refid="selectApplyListInfoVo"/>
|
||||
<where>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectApplyListInfoById" parameterType="Long" resultMap="ApplyListInfoResult">
|
||||
<include refid="selectApplyListInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertApplyListInfo" parameterType="ApplyListInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into APPLY_LIST_INFO
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="appName != null and appName != ''">app_name,</if>
|
||||
<if test="appDesc != null and appDesc != ''">app_desc,</if>
|
||||
<if test="picture != null">picture,</if>
|
||||
<if test="orderNum != null">order_num,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
<if test="created != null">created,</if>
|
||||
<if test="modified != null">modified,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="appName != null and appName != ''">#{appName},</if>
|
||||
<if test="appDesc != null and appDesc != ''">#{appDesc},</if>
|
||||
<if test="picture != null">#{picture},</if>
|
||||
<if test="orderNum != null">#{orderNum},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
<if test="created != null">#{created},</if>
|
||||
<if test="modified != null">#{modified},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateApplyListInfo" parameterType="ApplyListInfo">
|
||||
update APPLY_LIST_INFO
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="appName != null and appName != ''">app_name = #{appName},</if>
|
||||
<if test="appDesc != null and appDesc != ''">app_desc = #{appDesc},</if>
|
||||
<if test="picture != null">picture = #{picture},</if>
|
||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="created != null">created = #{created},</if>
|
||||
<if test="modified != null">modified = #{modified},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteApplyListInfoById" parameterType="Long">
|
||||
delete from APPLY_LIST_INFO where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteApplyListInfoByIds" parameterType="String">
|
||||
delete from APPLY_LIST_INFO where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,77 @@
|
||||
package com.sf.common.exception;
|
||||
|
||||
|
||||
import com.sf.common.enums.ErrorCodeTypeEnum;
|
||||
|
||||
/**
|
||||
* @author : yswjme@163.com
|
||||
* @Title : BusinessException.java
|
||||
* @Package : com.zsmarter.ai.word.exception
|
||||
* @Descript : 业务运行时异常
|
||||
* @date : 2020-06-29 04:59:44
|
||||
* @vsersion : V1.0
|
||||
*/
|
||||
public class BusinessException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 4693786499059513760L;
|
||||
|
||||
private ErrorCodeTypeEnum errorCodeTypeEnum;
|
||||
|
||||
private final String errorDescription;
|
||||
|
||||
private String errorCode;
|
||||
|
||||
public BusinessException(String errorDescription) {
|
||||
super(errorDescription);
|
||||
this.errorDescription = errorDescription;
|
||||
}
|
||||
|
||||
public BusinessException(String errorDescription, Throwable t) {
|
||||
super(errorDescription, t);
|
||||
this.errorDescription = errorDescription;
|
||||
}
|
||||
|
||||
public BusinessException(String code, String errorDescription) {
|
||||
super(errorDescription);
|
||||
this.errorDescription = errorDescription;
|
||||
this.errorCode = code;
|
||||
}
|
||||
|
||||
public BusinessException(String code, String errorDescription, Throwable t) {
|
||||
super(errorDescription, t);
|
||||
this.errorDescription = errorDescription;
|
||||
this.errorCode = code;
|
||||
}
|
||||
|
||||
public BusinessException(ErrorCodeTypeEnum errorCodeTypeEnum, String code, String errorDescription) {
|
||||
super(errorDescription);
|
||||
this.errorDescription = errorDescription;
|
||||
this.errorCode = code;
|
||||
this.errorCodeTypeEnum = errorCodeTypeEnum;
|
||||
}
|
||||
|
||||
public BusinessException(ErrorCodeTypeEnum errorCodeTypeEnum, String code, String errorDescription, Throwable t) {
|
||||
super(errorDescription, t);
|
||||
this.errorDescription = errorDescription;
|
||||
this.errorCode = code;
|
||||
this.errorCodeTypeEnum = errorCodeTypeEnum;
|
||||
}
|
||||
|
||||
public String getErrorDescription() {
|
||||
return this.errorDescription;
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public String getErrorTitle() {
|
||||
return "业务校验失败!";
|
||||
}
|
||||
|
||||
public ErrorCodeTypeEnum getErrorCodeTypeEnum() {
|
||||
return errorCodeTypeEnum;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
package com.sf.common.utils;
|
||||
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Tiwtter.SnowFlake的结构如下(每部分用-分开):<br>
|
||||
* 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000 <br>
|
||||
* 1位标识,由于long基本类型在Java中是带符号的,最高位是符号位,正数是0,负数是1,所以id一般是正数,最高位是0<br>
|
||||
* 41位时间截(毫秒级),注意,41位时间截不是存储当前时间的时间截,而是存储时间截的差值(当前时间截 - 开始时间截)
|
||||
* 得到的值),这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序IdWorker类的startTime属性)。41位的时间截,可以使用69年,年T = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69<br>
|
||||
* 10位的数据机器位,可以部署在1024个节点,包括5位datacenterId和5位workerId<br>
|
||||
* 12位序列,毫秒内的计数,12位的计数顺序号支持每个节点每毫秒(同一机器,同一时间截)产生4096个ID序号<br>
|
||||
* 加起来刚好64位,为一个Long型。<br>
|
||||
* SnowFlake的优点是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由数据中心ID和机器ID作区分),并且效率较高,经测试,SnowFlake每秒能够产生26万ID左右。
|
||||
* @author yswjme@163.com
|
||||
* @date :
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class SnowflakeIdWorker {
|
||||
|
||||
/** 开始时间截 (2018-01-01) ,不可修改 */
|
||||
private final long twepoch = 1420041600000L;
|
||||
|
||||
/** 机器id所占的位数 */
|
||||
private final long workerIdBits = 5L;
|
||||
|
||||
/** 数据标识id所占的位数 */
|
||||
private final long datacenterIdBits = 5L;
|
||||
|
||||
/** 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) */
|
||||
private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
|
||||
|
||||
/** 支持的最大数据标识id,结果是31 */
|
||||
private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
|
||||
|
||||
/** 序列在id中占的位数 */
|
||||
private final long sequenceBits = 12L;
|
||||
|
||||
/** 机器ID向左移12位 */
|
||||
private final long workerIdShift = sequenceBits;
|
||||
|
||||
/** 数据标识id向左移17位(12+5) */
|
||||
private final long datacenterIdShift = sequenceBits + workerIdBits;
|
||||
|
||||
/** 时间截向左移22位(5+5+12) */
|
||||
private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
|
||||
|
||||
/** 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) */
|
||||
private final long sequenceMask = -1L ^ (-1L << sequenceBits);
|
||||
|
||||
/** 工作机器ID(0~31) */
|
||||
private long workerId;
|
||||
|
||||
/** 数据中心ID(0~31) */
|
||||
private long datacenterId;
|
||||
|
||||
/** 毫秒内序列(0~4095) */
|
||||
private long sequence = 0L;
|
||||
|
||||
/** 上次生成ID的时间截 */
|
||||
private long lastTimestamp = -1L;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*
|
||||
* @param workerId 工作ID (0~31)
|
||||
* @param datacenterId 数据中心ID (0~31)
|
||||
*/
|
||||
public SnowflakeIdWorker(long workerId, long datacenterId) {
|
||||
if (workerId > maxWorkerId || workerId < 0) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"worker Id can't be greater than %d or less than 0",
|
||||
maxWorkerId));
|
||||
}
|
||||
if (datacenterId > maxDatacenterId || datacenterId < 0) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"datacenter Id can't be greater than %d or less than 0",
|
||||
maxDatacenterId));
|
||||
}
|
||||
this.workerId = workerId;
|
||||
this.datacenterId = datacenterId;
|
||||
}
|
||||
|
||||
public SnowflakeIdWorker() {
|
||||
};
|
||||
|
||||
/**
|
||||
* 获得下一个ID (该方法是线程安全的)
|
||||
*
|
||||
* @return SnowflakeId
|
||||
*/
|
||||
public synchronized long nextId() {
|
||||
long timestamp = timeGen();
|
||||
|
||||
// 如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
|
||||
if (timestamp < lastTimestamp) {
|
||||
throw new RuntimeException(
|
||||
String.format(
|
||||
"Clock moved backwards. Refusing to generate id for %d milliseconds",
|
||||
lastTimestamp - timestamp));
|
||||
}
|
||||
|
||||
// 如果是同一时间生成的,则进行毫秒内序列
|
||||
if (lastTimestamp == timestamp) {
|
||||
sequence = (sequence + 1) & sequenceMask;
|
||||
// 毫秒内序列溢出
|
||||
if (sequence == 0) {
|
||||
// 阻塞到下一个毫秒,获得新的时间戳
|
||||
timestamp = tilNextMillis(lastTimestamp);
|
||||
}
|
||||
}else {// 时间戳改变,毫秒内序列重置
|
||||
sequence = 0L;
|
||||
}
|
||||
|
||||
// 上次生成ID的时间截
|
||||
lastTimestamp = timestamp;
|
||||
|
||||
// 移位并通过或运算拼到一起组成64位的ID
|
||||
return ((timestamp - twepoch) << timestampLeftShift) //
|
||||
| (datacenterId << datacenterIdShift) //
|
||||
| (workerId << workerIdShift) //
|
||||
| sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* 阻塞到下一个毫秒,直到获得新的时间戳
|
||||
*
|
||||
* @param lastTimestamp
|
||||
* 上次生成ID的时间截
|
||||
* @return 当前时间戳
|
||||
*/
|
||||
protected long tilNextMillis(long lastTimestamp) {
|
||||
long timestamp = timeGen();
|
||||
while (timestamp <= lastTimestamp) {
|
||||
timestamp = timeGen();
|
||||
}
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回以毫秒为单位的当前时间
|
||||
*
|
||||
* @return 当前时间(毫秒)
|
||||
*/
|
||||
protected long timeGen() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
}
|
34
sf-order/pom.xml
Normal file
34
sf-order/pom.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?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>smarterFramework</artifactId>
|
||||
<groupId>com.smarterFramework</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>sf-order</artifactId>
|
||||
|
||||
<description>
|
||||
order订单模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.smarterFramework</groupId>
|
||||
<artifactId>sf-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
367
sf-order/src/main/java/com/sf/order/domain/OrderInfo.java
Normal file
367
sf-order/src/main/java/com/sf/order/domain/OrderInfo.java
Normal file
@ -0,0 +1,367 @@
|
||||
package com.sf.order.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.sf.common.annotation.Excel;
|
||||
import com.sf.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 订单基础信息对象 ORDER_INFO
|
||||
*
|
||||
* @author ztzh
|
||||
* @date 2024-04-09
|
||||
*/
|
||||
public class OrderInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@Excel(name = "订单编号")
|
||||
private Long orderNo;
|
||||
|
||||
/**
|
||||
* 订单状态:
|
||||
* 0:待支付
|
||||
* 1:已付款
|
||||
* 2:支付超时系统结束
|
||||
* 3:已完成
|
||||
*/
|
||||
@Excel(name = "订单状态: 0:待支付 1:已付款 2:支付超时系统结束 3:已完成 ")
|
||||
private Long orderStatus;
|
||||
|
||||
/**
|
||||
* 支付方式:0-点券 1-现金
|
||||
*/
|
||||
@Excel(name = "支付方式:0-点券 1-现金")
|
||||
private Long payType;
|
||||
|
||||
/**
|
||||
* 支付渠道(支付方式为现金时)
|
||||
* 0:微信
|
||||
* 1:支付宝
|
||||
*/
|
||||
@Excel(name = "支付渠道(支付方式为现金时) 0:微信 1:支付宝")
|
||||
private Long payChannel;
|
||||
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
@Excel(name = "订单金额")
|
||||
private Long orderAmt;
|
||||
|
||||
/**
|
||||
* 运费
|
||||
*/
|
||||
@Excel(name = "运费")
|
||||
private Long freightAmt;
|
||||
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
@Excel(name = "总金额")
|
||||
private Long payAmt;
|
||||
|
||||
/**
|
||||
* 实际支付金额
|
||||
*/
|
||||
@Excel(name = "实际支付金额")
|
||||
private Long reallyAmt;
|
||||
|
||||
/**
|
||||
* 收件方式
|
||||
* :0-自提
|
||||
* 1-快递 2-配送
|
||||
*/
|
||||
@Excel(name = "收件方式:0-自提 1-快递 2-配送")
|
||||
private Long receiveType;
|
||||
|
||||
/**
|
||||
* 商品Id
|
||||
*/
|
||||
@Excel(name = "商品Id")
|
||||
private Long goodsId;
|
||||
|
||||
/**
|
||||
* 商户Id
|
||||
*/
|
||||
@Excel(name = "商户Id")
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 收货地址配置Id
|
||||
*/
|
||||
@Excel(name = "收货地址配置Id")
|
||||
private Long receiveAddrId;
|
||||
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date payTime;
|
||||
|
||||
/**
|
||||
* 订单创建人
|
||||
*/
|
||||
@Excel(name = "订单创建人")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 最后一次更新操作人
|
||||
*/
|
||||
@Excel(name = "最后一次更新操作人")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 逻辑删除标识
|
||||
* 0:未删除
|
||||
* 1:已删除
|
||||
*/
|
||||
@Excel(name = "逻辑删除标识 0:未删除 1:已删除")
|
||||
private Long isDelete;
|
||||
|
||||
/**
|
||||
* 快递单号
|
||||
*/
|
||||
@Excel(name = "快递单号")
|
||||
private String trackNo;
|
||||
|
||||
/**
|
||||
* 订单类型0:自动1:手动
|
||||
*/
|
||||
@Excel(name = "订单类型0:自动1:手动")
|
||||
private Long orderType;
|
||||
|
||||
/**
|
||||
* 平台外部订单号
|
||||
*/
|
||||
@Excel(name = "平台外部订单号")
|
||||
private Long outOrderNo;
|
||||
|
||||
/**
|
||||
* 平台支付返回值
|
||||
*/
|
||||
@Excel(name = "平台支付返回值")
|
||||
private String payData;
|
||||
|
||||
/**
|
||||
* 减免金额(优惠券抵扣)
|
||||
*/
|
||||
@Excel(name = "减免金额(优惠券抵扣)")
|
||||
private Long reductionAmout;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setOrderNo(Long orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public Long getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderStatus(Long orderStatus) {
|
||||
this.orderStatus = orderStatus;
|
||||
}
|
||||
|
||||
public Long getOrderStatus() {
|
||||
return orderStatus;
|
||||
}
|
||||
|
||||
public void setPayType(Long payType) {
|
||||
this.payType = payType;
|
||||
}
|
||||
|
||||
public Long getPayType() {
|
||||
return payType;
|
||||
}
|
||||
|
||||
public void setPayChannel(Long payChannel) {
|
||||
this.payChannel = payChannel;
|
||||
}
|
||||
|
||||
public Long getPayChannel() {
|
||||
return payChannel;
|
||||
}
|
||||
|
||||
public void setOrderAmt(Long orderAmt) {
|
||||
this.orderAmt = orderAmt;
|
||||
}
|
||||
|
||||
public Long getOrderAmt() {
|
||||
return orderAmt;
|
||||
}
|
||||
|
||||
public void setFreightAmt(Long freightAmt) {
|
||||
this.freightAmt = freightAmt;
|
||||
}
|
||||
|
||||
public Long getFreightAmt() {
|
||||
return freightAmt;
|
||||
}
|
||||
|
||||
public void setPayAmt(Long payAmt) {
|
||||
this.payAmt = payAmt;
|
||||
}
|
||||
|
||||
public Long getPayAmt() {
|
||||
return payAmt;
|
||||
}
|
||||
|
||||
public void setReallyAmt(Long reallyAmt) {
|
||||
this.reallyAmt = reallyAmt;
|
||||
}
|
||||
|
||||
public Long getReallyAmt() {
|
||||
return reallyAmt;
|
||||
}
|
||||
|
||||
public void setReceiveType(Long receiveType) {
|
||||
this.receiveType = receiveType;
|
||||
}
|
||||
|
||||
public Long getReceiveType() {
|
||||
return receiveType;
|
||||
}
|
||||
|
||||
public void setGoodsId(Long goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public Long getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setBusinessId(Long businessId) {
|
||||
this.businessId = businessId;
|
||||
}
|
||||
|
||||
public Long getBusinessId() {
|
||||
return businessId;
|
||||
}
|
||||
|
||||
public void setReceiveAddrId(Long receiveAddrId) {
|
||||
this.receiveAddrId = receiveAddrId;
|
||||
}
|
||||
|
||||
public Long getReceiveAddrId() {
|
||||
return receiveAddrId;
|
||||
}
|
||||
|
||||
public void setPayTime(Date payTime) {
|
||||
this.payTime = payTime;
|
||||
}
|
||||
|
||||
public Date getPayTime() {
|
||||
return payTime;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setUpdateUserId(Long updateUserId) {
|
||||
this.updateUserId = updateUserId;
|
||||
}
|
||||
|
||||
public Long getUpdateUserId() {
|
||||
return updateUserId;
|
||||
}
|
||||
|
||||
public void setIsDelete(Long isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public Long getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setTrackNo(String trackNo) {
|
||||
this.trackNo = trackNo;
|
||||
}
|
||||
|
||||
public String getTrackNo() {
|
||||
return trackNo;
|
||||
}
|
||||
|
||||
public void setOrderType(Long orderType) {
|
||||
this.orderType = orderType;
|
||||
}
|
||||
|
||||
public Long getOrderType() {
|
||||
return orderType;
|
||||
}
|
||||
|
||||
public void setOutOrderNo(Long outOrderNo) {
|
||||
this.outOrderNo = outOrderNo;
|
||||
}
|
||||
|
||||
public Long getOutOrderNo() {
|
||||
return outOrderNo;
|
||||
}
|
||||
|
||||
public void setPayData(String payData) {
|
||||
this.payData = payData;
|
||||
}
|
||||
|
||||
public String getPayData() {
|
||||
return payData;
|
||||
}
|
||||
|
||||
public void setReductionAmout(Long reductionAmout) {
|
||||
this.reductionAmout = reductionAmout;
|
||||
}
|
||||
|
||||
public Long getReductionAmout() {
|
||||
return reductionAmout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("orderNo", getOrderNo())
|
||||
.append("orderStatus", getOrderStatus())
|
||||
.append("payType", getPayType())
|
||||
.append("payChannel", getPayChannel())
|
||||
.append("orderAmt", getOrderAmt())
|
||||
.append("freightAmt", getFreightAmt())
|
||||
.append("payAmt", getPayAmt())
|
||||
.append("reallyAmt", getReallyAmt())
|
||||
.append("receiveType", getReceiveType())
|
||||
.append("goodsId", getGoodsId())
|
||||
.append("businessId", getBusinessId())
|
||||
.append("receiveAddrId", getReceiveAddrId())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("payTime", getPayTime())
|
||||
.append("createUserId", getCreateUserId())
|
||||
.append("updateUserId", getUpdateUserId())
|
||||
.append("isDelete", getIsDelete())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("trackNo", getTrackNo())
|
||||
.append("orderType", getOrderType())
|
||||
.append("outOrderNo", getOutOrderNo())
|
||||
.append("payData", getPayData())
|
||||
.append("reductionAmout", getReductionAmout())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.sf.order.domain.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author : ztzh
|
||||
* @since : 2023/7/27
|
||||
*/
|
||||
@Schema(description = "下单")
|
||||
public class OrderCreateDto {
|
||||
|
||||
@Schema(description = "商品id")
|
||||
@NotNull(message = "商品id不能为空")
|
||||
private Long goodsId;
|
||||
|
||||
@Schema(description = "数量")
|
||||
@NotNull(message = "数量不能唯恐")
|
||||
private Long count;
|
||||
|
||||
@Schema(description = "金额")
|
||||
@NotNull(message = "金额不能为空")
|
||||
private Long amount;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
@NotNull(message = "用户id不能空")
|
||||
private Long userId;
|
||||
|
||||
public Long getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(Long goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
public Long getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Long getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(Long amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.sf.order.domain.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrderListreqVo {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 订单类型
|
||||
*/
|
||||
private Long orderStatus;
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
private Integer pageNo;
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.sf.order.domain.res;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 活动信息详情
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Schema(name = "OrderListResVo", description = "订单列表")
|
||||
public class OrderListResVo {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 订单状态:
|
||||
* 0:待支付
|
||||
* 1:已付款
|
||||
* 2:支付超时系统结束
|
||||
* 3:已完成
|
||||
*/
|
||||
private Long orderStatus;
|
||||
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
private Long orderAmt;
|
||||
|
||||
/**
|
||||
* 商品标题
|
||||
*/
|
||||
private String productTitle;
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private Integer goodsSpec;
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
private Integer goodsCount = 1;
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.sf.order.mapper;
|
||||
|
||||
import com.sf.order.domain.OrderInfo;
|
||||
import com.sf.order.domain.req.OrderListreqVo;
|
||||
import com.sf.order.domain.res.OrderListResVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 订单基础信息Mapper接口
|
||||
*
|
||||
* @author ztzh
|
||||
* @date 2024-04-09
|
||||
*/
|
||||
public interface OrderInfoMapper {
|
||||
/**
|
||||
* 查询订单基础信息
|
||||
*
|
||||
* @param id 订单基础信息主键
|
||||
* @return 订单基础信息
|
||||
*/
|
||||
public OrderInfo selectOrderInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询订单基础信息列表
|
||||
*
|
||||
* @param orderInfo 订单基础信息
|
||||
* @return 订单基础信息集合
|
||||
*/
|
||||
public List<OrderInfo> selectOrderInfoList(OrderInfo orderInfo);
|
||||
|
||||
|
||||
List<OrderListResVo> queryList(OrderListreqVo vo);
|
||||
|
||||
/**
|
||||
* 新增订单基础信息
|
||||
*
|
||||
* @param orderInfo 订单基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertOrderInfo(OrderInfo orderInfo);
|
||||
|
||||
/**
|
||||
* 修改订单基础信息
|
||||
*
|
||||
* @param orderInfo 订单基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateOrderInfo(OrderInfo orderInfo);
|
||||
|
||||
/**
|
||||
* 删除订单基础信息
|
||||
*
|
||||
* @param id 订单基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOrderInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除订单基础信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOrderInfoByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.sf.order.service;
|
||||
|
||||
|
||||
import com.sf.order.domain.OrderInfo;
|
||||
import com.sf.order.domain.dto.OrderCreateDto;
|
||||
import com.sf.order.domain.req.OrderListreqVo;
|
||||
import com.sf.order.domain.res.OrderListResVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单基础信息Service接口
|
||||
*
|
||||
* @author ztzh
|
||||
* @date 2024-04-09
|
||||
*/
|
||||
public interface IOrderInfoService
|
||||
{
|
||||
/**
|
||||
* 查询订单基础信息
|
||||
*
|
||||
* @param id 订单基础信息主键
|
||||
* @return 订单基础信息
|
||||
*/
|
||||
public OrderInfo selectOrderInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询订单基础信息列表
|
||||
*
|
||||
* @param orderInfo 订单基础信息
|
||||
* @return 订单基础信息集合
|
||||
*/
|
||||
public List<OrderInfo> selectOrderInfoList(OrderInfo orderInfo);
|
||||
|
||||
/**
|
||||
* 查询订单基础信息列表
|
||||
*/
|
||||
List<OrderListResVo> queryList(OrderListreqVo vo);
|
||||
|
||||
/**
|
||||
* 新增订单基础信息
|
||||
*
|
||||
* @param orderInfo 订单基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int createOrder(OrderCreateDto orderInfo);
|
||||
|
||||
/**
|
||||
* 修改订单基础信息
|
||||
*
|
||||
* @param orderInfo 订单基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateOrderInfo(OrderInfo orderInfo);
|
||||
|
||||
/**
|
||||
* 批量删除订单基础信息
|
||||
*
|
||||
* @param ids 需要删除的订单基础信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOrderInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除订单基础信息信息
|
||||
*
|
||||
* @param id 订单基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOrderInfoById(Long id);
|
||||
|
||||
void orderPay(Long orderId);
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package com.sf.order.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.sf.common.exception.BusinessException;
|
||||
import com.sf.common.utils.DateUtils;
|
||||
import com.sf.common.utils.SnowflakeIdWorker;
|
||||
import com.sf.order.domain.OrderInfo;
|
||||
import com.sf.order.domain.dto.OrderCreateDto;
|
||||
import com.sf.order.domain.req.OrderListreqVo;
|
||||
import com.sf.order.domain.res.OrderListResVo;
|
||||
import com.sf.order.mapper.OrderInfoMapper;
|
||||
import com.sf.order.service.IOrderInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 订单基础信息Service业务层处理
|
||||
*
|
||||
* @author ztzh
|
||||
* @date 2024-04-09
|
||||
*/
|
||||
@Service
|
||||
public class OrderInfoServiceImpl implements IOrderInfoService
|
||||
{
|
||||
@Resource
|
||||
private OrderInfoMapper orderInfoMapper;
|
||||
@Resource
|
||||
private SnowflakeIdWorker snowflakeIdWorker;
|
||||
|
||||
/**
|
||||
* 查询订单基础信息
|
||||
*
|
||||
* @param id 订单基础信息主键
|
||||
* @return 订单基础信息
|
||||
*/
|
||||
@Override
|
||||
public OrderInfo selectOrderInfoById(Long id)
|
||||
{
|
||||
return orderInfoMapper.selectOrderInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单基础信息列表
|
||||
*
|
||||
* @param orderInfo 订单基础信息
|
||||
* @return 订单基础信息
|
||||
*/
|
||||
@Override
|
||||
public List<OrderInfo> selectOrderInfoList(OrderInfo orderInfo)
|
||||
{
|
||||
return orderInfoMapper.selectOrderInfoList(orderInfo);
|
||||
}
|
||||
public List<OrderListResVo> queryList(OrderListreqVo vo)
|
||||
{
|
||||
return orderInfoMapper.queryList(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增订单基础信息
|
||||
*
|
||||
* @param orderCreateDto 订单基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int createOrder(OrderCreateDto orderCreateDto)
|
||||
{
|
||||
OrderInfo orderInfo = new OrderInfo();
|
||||
orderInfo.setOrderNo(snowflakeIdWorker.nextId());
|
||||
orderInfo.setPayType(0L);
|
||||
orderInfo.setReceiveType(0L);
|
||||
orderInfo.setOrderStatus(0l);
|
||||
orderInfo.setCreateUserId(orderCreateDto.getUserId());
|
||||
orderInfo.setUpdateUserId(orderCreateDto.getUserId());
|
||||
orderInfo.setGoodsId(orderCreateDto.getGoodsId());
|
||||
orderInfo.setOrderAmt(orderCreateDto.getAmount());
|
||||
orderInfo.setPayAmt(orderCreateDto.getAmount());
|
||||
orderInfo.setCreateTime(DateUtils.getNowDate());
|
||||
orderInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return orderInfoMapper.insertOrderInfo(orderInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单基础信息
|
||||
*
|
||||
* @param orderInfo 订单基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateOrderInfo(OrderInfo orderInfo)
|
||||
{
|
||||
orderInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return orderInfoMapper.updateOrderInfo(orderInfo);
|
||||
}
|
||||
@Override
|
||||
public void orderPay(Long orderId) {
|
||||
OrderInfo updateOrder = this.selectOrderInfoById(orderId);
|
||||
if (updateOrder == null) {
|
||||
throw new BusinessException("订单缺失!");
|
||||
}
|
||||
// if (!OrderInfoConstant.ORDER_WAITING_FOR_PAYMENT.equals(orderInfo.getOrderStatus())) {
|
||||
// throw new BusinessException("订单状态异常!");
|
||||
// }
|
||||
updateOrder.setOrderStatus(1L);
|
||||
updateOrder.setPayTime(DateUtils.getNowDate());
|
||||
// 修改订单状态
|
||||
if (1>this.updateOrderInfo(updateOrder)) {
|
||||
throw new BusinessException("支付异常,请联系管理员!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除订单基础信息
|
||||
*
|
||||
* @param ids 需要删除的订单基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteOrderInfoByIds(Long[] ids)
|
||||
{
|
||||
return orderInfoMapper.deleteOrderInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单基础信息信息
|
||||
*
|
||||
* @param id 订单基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteOrderInfoById(Long id)
|
||||
{
|
||||
return orderInfoMapper.deleteOrderInfoById(id);
|
||||
}
|
||||
|
||||
}
|
172
sf-order/src/main/resources/mapper/order/OrderInfoMapper.xml
Normal file
172
sf-order/src/main/resources/mapper/order/OrderInfoMapper.xml
Normal file
@ -0,0 +1,172 @@
|
||||
<?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.sf.order.mapper.OrderInfoMapper">
|
||||
|
||||
<resultMap type="OrderInfo" id="OrderInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="orderNo" column="order_no" />
|
||||
<result property="orderStatus" column="order_status" />
|
||||
<result property="payType" column="pay_type" />
|
||||
<result property="payChannel" column="pay_channel" />
|
||||
<result property="orderAmt" column="order_amt" />
|
||||
<result property="freightAmt" column="freight_amt" />
|
||||
<result property="payAmt" column="pay_amt" />
|
||||
<result property="reallyAmt" column="really_amt" />
|
||||
<result property="receiveType" column="receive_type" />
|
||||
<result property="goodsId" column="goods_id" />
|
||||
<result property="businessId" column="business_id" />
|
||||
<result property="receiveAddrId" column="receive_addr_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="payTime" column="pay_time" />
|
||||
<result property="createUserId" column="create_user_id" />
|
||||
<result property="updateUserId" column="update_user_id" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="trackNo" column="track_no" />
|
||||
<result property="orderType" column="order_type" />
|
||||
<result property="outOrderNo" column="out_order_no" />
|
||||
<result property="payData" column="pay_data" />
|
||||
<result property="reductionAmout" column="reduction_amout" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOrderInfoVo">
|
||||
select id, order_no, order_status, pay_type, pay_channel, order_amt, freight_amt, pay_amt, really_amt, receive_type, goods_id, business_id, receive_addr_id, create_time, pay_time, create_user_id, update_user_id, is_delete, update_time, track_no, order_type, out_order_no, pay_data, reduction_amout from ORDER_INFO
|
||||
</sql>
|
||||
<sql id="OrderListResVo">
|
||||
select id, order_no, order_status, pay_type, productTitle, order_amt, freight_amt, pay_amt, really_amt, receive_type, goods_id, business_id, receive_addr_id, create_time, pay_time, create_user_id, update_user_id, is_delete, update_time, track_no, order_type, out_order_no, pay_data, reduction_amout from ORDER_INFO
|
||||
</sql>
|
||||
|
||||
<select id="selectOrderInfoList" parameterType="OrderInfo" resultMap="OrderInfoResult">
|
||||
<include refid="selectOrderInfoVo"/>
|
||||
<where>
|
||||
<if test="orderNo != null "> and order_no = #{orderNo}</if>
|
||||
<if test="orderStatus != null "> and order_status = #{orderStatus}</if>
|
||||
<if test="payType != null "> and pay_type = #{payType}</if>
|
||||
<if test="payChannel != null "> and pay_channel = #{payChannel}</if>
|
||||
<if test="orderAmt != null "> and order_amt = #{orderAmt}</if>
|
||||
<if test="freightAmt != null "> and freight_amt = #{freightAmt}</if>
|
||||
<if test="payAmt != null "> and pay_amt = #{payAmt}</if>
|
||||
<if test="reallyAmt != null "> and really_amt = #{reallyAmt}</if>
|
||||
<if test="receiveType != null "> and receive_type = #{receiveType}</if>
|
||||
<if test="goodsId != null "> and goods_id = #{goodsId}</if>
|
||||
<if test="businessId != null "> and business_id = #{businessId}</if>
|
||||
<if test="receiveAddrId != null "> and receive_addr_id = #{receiveAddrId}</if>
|
||||
<if test="payTime != null "> and pay_time = #{payTime}</if>
|
||||
<if test="createUserId != null "> and create_user_id = #{createUserId}</if>
|
||||
<if test="updateUserId != null "> and update_user_id = #{updateUserId}</if>
|
||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
||||
<if test="trackNo != null and trackNo != ''"> and track_no = #{trackNo}</if>
|
||||
<if test="orderType != null "> and order_type = #{orderType}</if>
|
||||
<if test="outOrderNo != null "> and out_order_no = #{outOrderNo}</if>
|
||||
<if test="payData != null and payData != ''"> and pay_data = #{payData}</if>
|
||||
<if test="reductionAmout != null "> and reduction_amout = #{reductionAmout}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectOrderInfoById" parameterType="Long" resultMap="OrderInfoResult">
|
||||
<include refid="selectOrderInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="queryList" resultType="com.sf.order.domain.res.OrderListResVo">
|
||||
|
||||
</select>
|
||||
|
||||
<insert id="insertOrderInfo" parameterType="OrderInfo">
|
||||
insert into ORDER_INFO
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="orderNo != null">order_no,</if>
|
||||
<if test="orderStatus != null">order_status,</if>
|
||||
<if test="payType != null">pay_type,</if>
|
||||
<if test="payChannel != null">pay_channel,</if>
|
||||
<if test="orderAmt != null">order_amt,</if>
|
||||
<if test="freightAmt != null">freight_amt,</if>
|
||||
<if test="payAmt != null">pay_amt,</if>
|
||||
<if test="reallyAmt != null">really_amt,</if>
|
||||
<if test="receiveType != null">receive_type,</if>
|
||||
<if test="goodsId != null">goods_id,</if>
|
||||
<if test="businessId != null">business_id,</if>
|
||||
<if test="receiveAddrId != null">receive_addr_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="payTime != null">pay_time,</if>
|
||||
<if test="createUserId != null">create_user_id,</if>
|
||||
<if test="updateUserId != null">update_user_id,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="trackNo != null">track_no,</if>
|
||||
<if test="orderType != null">order_type,</if>
|
||||
<if test="outOrderNo != null">out_order_no,</if>
|
||||
<if test="payData != null">pay_data,</if>
|
||||
<if test="reductionAmout != null">reduction_amout,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="orderNo != null">#{orderNo},</if>
|
||||
<if test="orderStatus != null">#{orderStatus},</if>
|
||||
<if test="payType != null">#{payType},</if>
|
||||
<if test="payChannel != null">#{payChannel},</if>
|
||||
<if test="orderAmt != null">#{orderAmt},</if>
|
||||
<if test="freightAmt != null">#{freightAmt},</if>
|
||||
<if test="payAmt != null">#{payAmt},</if>
|
||||
<if test="reallyAmt != null">#{reallyAmt},</if>
|
||||
<if test="receiveType != null">#{receiveType},</if>
|
||||
<if test="goodsId != null">#{goodsId},</if>
|
||||
<if test="businessId != null">#{businessId},</if>
|
||||
<if test="receiveAddrId != null">#{receiveAddrId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="payTime != null">#{payTime},</if>
|
||||
<if test="createUserId != null">#{createUserId},</if>
|
||||
<if test="updateUserId != null">#{updateUserId},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="trackNo != null">#{trackNo},</if>
|
||||
<if test="orderType != null">#{orderType},</if>
|
||||
<if test="outOrderNo != null">#{outOrderNo},</if>
|
||||
<if test="payData != null">#{payData},</if>
|
||||
<if test="reductionAmout != null">#{reductionAmout},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateOrderInfo" parameterType="OrderInfo">
|
||||
update ORDER_INFO
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="orderNo != null">order_no = #{orderNo},</if>
|
||||
<if test="orderStatus != null">order_status = #{orderStatus},</if>
|
||||
<if test="payType != null">pay_type = #{payType},</if>
|
||||
<if test="payChannel != null">pay_channel = #{payChannel},</if>
|
||||
<if test="orderAmt != null">order_amt = #{orderAmt},</if>
|
||||
<if test="freightAmt != null">freight_amt = #{freightAmt},</if>
|
||||
<if test="payAmt != null">pay_amt = #{payAmt},</if>
|
||||
<if test="reallyAmt != null">really_amt = #{reallyAmt},</if>
|
||||
<if test="receiveType != null">receive_type = #{receiveType},</if>
|
||||
<if test="goodsId != null">goods_id = #{goodsId},</if>
|
||||
<if test="businessId != null">business_id = #{businessId},</if>
|
||||
<if test="receiveAddrId != null">receive_addr_id = #{receiveAddrId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="payTime != null">pay_time = #{payTime},</if>
|
||||
<if test="createUserId != null">create_user_id = #{createUserId},</if>
|
||||
<if test="updateUserId != null">update_user_id = #{updateUserId},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="trackNo != null">track_no = #{trackNo},</if>
|
||||
<if test="orderType != null">order_type = #{orderType},</if>
|
||||
<if test="outOrderNo != null">out_order_no = #{outOrderNo},</if>
|
||||
<if test="payData != null">pay_data = #{payData},</if>
|
||||
<if test="reductionAmout != null">reduction_amout = #{reductionAmout},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteOrderInfoById" parameterType="Long">
|
||||
delete from ORDER_INFO where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteOrderInfoByIds" parameterType="String">
|
||||
delete from ORDER_INFO where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
44
sf-ui/src/api/deploy/INFO.js
Normal file
44
sf-ui/src/api/deploy/INFO.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询安装包管理(新)列表
|
||||
export function listINFO(query) {
|
||||
return request({
|
||||
url: '/deploy/INFO/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询安装包管理(新)详细
|
||||
export function getINFO(id) {
|
||||
return request({
|
||||
url: '/deploy/INFO/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增安装包管理(新)
|
||||
export function addINFO(data) {
|
||||
return request({
|
||||
url: '/deploy/INFO',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改安装包管理(新)
|
||||
export function updateINFO(data) {
|
||||
return request({
|
||||
url: '/deploy/INFO',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除安装包管理(新)
|
||||
export function delINFO(id) {
|
||||
return request({
|
||||
url: '/deploy/INFO/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
44
sf-ui/src/api/goods/goods.js
Normal file
44
sf-ui/src/api/goods/goods.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询商品信息列表
|
||||
export function listGoods(query) {
|
||||
return request({
|
||||
url: '/goods/goods/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询商品信息详细
|
||||
export function getGoods(id) {
|
||||
return request({
|
||||
url: '/goods/goods/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增商品信息
|
||||
export function addGoods(data) {
|
||||
return request({
|
||||
url: '/goods/goods',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改商品信息
|
||||
export function updateGoods(data) {
|
||||
return request({
|
||||
url: '/goods/goods',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除商品信息
|
||||
export function delGoods(id) {
|
||||
return request({
|
||||
url: '/goods/goods/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
199
sf-ui/src/views/deploy/INFO/add.vue
Normal file
199
sf-ui/src/views/deploy/INFO/add.vue
Normal file
@ -0,0 +1,199 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div>新增安装包</div>
|
||||
<el-divider/>
|
||||
</el-header>
|
||||
<el-main>
|
||||
<div class="form-main">
|
||||
<el-form ref="elForm" :model="formData" :rules="rules" label-width="100px" size="medium">
|
||||
<el-form-item label="上传方式" prop="field102">
|
||||
<el-radio-group v-model="formData.field102" size="medium">
|
||||
<el-radio v-for="(item, index) in field102Options" :key="index" :disabled="item.disabled"
|
||||
:label="item.value"
|
||||
>{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="activeTabs===1" label="安装包名称" prop="field103">
|
||||
<el-input v-model="formData.field103" :style="{width: '100%'}" clearable placeholder="请输入安装包名称">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-else label="模块包名称" prop="field107">
|
||||
<el-input v-model="formData.field107" :style="{width: '100%'}" clearable placeholder="请输入模块包名称">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="field104">
|
||||
<el-input v-model="formData.field104" :style="{width: '100%'}" clearable placeholder="请输入版本号">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="安装包文件" prop="field101">
|
||||
<el-upload ref="field101" :action="field101Action" :before-upload="field101BeforeUpload"
|
||||
:file-list="field101fileList"
|
||||
>
|
||||
<el-button icon="el-icon-upload" size="small" type="primary">上传文件</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="安装包大小" prop="field105">
|
||||
<el-input v-model="formData.field105" :style="{width: '100%'}" clearable placeholder="请输入安装包大小">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="适用系统" prop="field106">
|
||||
<el-radio-group v-model="formData.field106" size="medium">
|
||||
<el-radio v-for="(item, index) in field106Options" :key="index" :disabled="item.disabled"
|
||||
:label="item.value"
|
||||
>{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item v-if="activeTabs!='1'" label="适用模块" prop="configName">-->
|
||||
<!-- <el-select v-model="formData.field108" clearable placeholder="请选择对应的模块">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in dict.type.sys_yes_no"-->
|
||||
<!-- :key="dict.value"-->
|
||||
<!-- :label="dict.label"-->
|
||||
<!-- :value="dict.value"-->
|
||||
<!-- />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item size="large">
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
<el-button @click="resetForm">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!-- <div slot="footer" class="dialog-footer">-->
|
||||
<!-- <el-button type="primary" @click="submitAddForm()">保 存</el-button>-->
|
||||
<!-- <el-button @click="cancel">取 消</el-button>-->
|
||||
<!-- </div>-->
|
||||
</el-main>
|
||||
</el-container>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'InstallAdd',
|
||||
dicts: ['sys_yes_no'],
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
field102: 1,
|
||||
field103: undefined,
|
||||
field104: undefined,
|
||||
field101: null,
|
||||
field105: undefined,
|
||||
field106: 'Android',
|
||||
field107: undefined,
|
||||
field108: undefined
|
||||
},
|
||||
rules: {
|
||||
field102: [{
|
||||
required: true,
|
||||
message: '上传方式不能为空',
|
||||
trigger: 'change'
|
||||
}],
|
||||
field103: [{
|
||||
required: true,
|
||||
message: '请输入安装包名称',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
field107: [{
|
||||
required: true,
|
||||
message: '请输入模块包名称',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
field105: [],
|
||||
field106: []
|
||||
},
|
||||
field101Action: 'https://jsonplaceholder.typicode.com/posts/',
|
||||
field101fileList: [],
|
||||
field102Options: [{
|
||||
'label': '在线上传',
|
||||
'value': 1
|
||||
}, {
|
||||
'label': '离线上传',
|
||||
'value': 2
|
||||
}],
|
||||
field106Options: [{
|
||||
'label': 'Android',
|
||||
'value': 'Android'
|
||||
}, {
|
||||
'label': 'IOS',
|
||||
'value': 'IOS'
|
||||
}, {
|
||||
'label': '鸿蒙',
|
||||
'value': 'HarmonyOS'
|
||||
}],
|
||||
activeTabs: '1'
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
mounted() {
|
||||
console.log(this.$route)
|
||||
this.activeTabs = this.$route.params.activeTabs
|
||||
},
|
||||
methods: {
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs['elForm'].validate(valid => {
|
||||
if (!valid) return
|
||||
// TODO 提交表单
|
||||
})
|
||||
},
|
||||
|
||||
// submitAddForm: function() {
|
||||
// this.$refs['form'].validate(valid => {
|
||||
// if (valid) {
|
||||
// if (this.form.configId != undefined) {
|
||||
// updateConfig(this.form).then(response => {
|
||||
// this.$modal.msgSuccess('修改成功')
|
||||
// this.closeModal()
|
||||
// })
|
||||
// } else {
|
||||
// addConfig(this.form).then(response => {
|
||||
// this.$modal.msgSuccess('新增成功')
|
||||
// this.closeModal()
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
// 重置表单
|
||||
resetForm() {
|
||||
this.$refs['elForm'].resetFields()
|
||||
},
|
||||
field101BeforeUpload(file) {
|
||||
let isRightSize = file.size / 1024 / 1024 < 2
|
||||
if (!isRightSize) {
|
||||
this.$message.error('文件大小超过 2MB')
|
||||
}
|
||||
return isRightSize
|
||||
},
|
||||
cancel() {
|
||||
this.history.back()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
background: #ffffff;
|
||||
margin: 24px;
|
||||
}
|
||||
|
||||
.form-main {
|
||||
width: 700px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
::v-deep .el-input.is-disabled .el-input__inner, .el-textarea.is-disabled .el-textarea__inner {
|
||||
border: 1px solid #E4E7ED !important;
|
||||
}
|
||||
|
||||
.el-upload__tip {
|
||||
line-height: 1.2;
|
||||
}
|
||||
</style>
|
332
sf-ui/src/views/deploy/INFO/index.vue
Normal file
332
sf-ui/src/views/deploy/INFO/index.vue
Normal file
@ -0,0 +1,332 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-tabs v-model="activeTabs" type="card" @tab-click="handleClickTabs">
|
||||
<el-tab-pane
|
||||
v-for="item in packTabs"
|
||||
:key="item.name"
|
||||
:label="item.title"
|
||||
:name="item.name"
|
||||
>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="90px" size="small">
|
||||
<el-form-item label="上传类型" prop="uploadingType">
|
||||
<el-select v-model="queryParams.uploadingType" clearable placeholder="请选择上传类型">
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_apk_uploading_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="安装包名称" prop="sysApkName">
|
||||
<el-input
|
||||
v-model="queryParams.sysApkName"
|
||||
clearable
|
||||
placeholder="请输入安装包名称"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input
|
||||
v-model="queryParams.version"
|
||||
clearable
|
||||
placeholder="请输入版本号"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="安装包类型" prop="sysType">
|
||||
<el-select v-model="queryParams.sysType" clearable placeholder="请选择安装包类型">
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_apk_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传状态" prop="uploadingStatus">
|
||||
<el-select v-model="queryParams.uploadingStatus" clearable placeholder="请选择上传状态">
|
||||
<el-option
|
||||
v-for="dict in dict.type.uploading_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="created">
|
||||
<el-input
|
||||
v-model="queryParams.created"
|
||||
clearable
|
||||
placeholder="请输入创建人"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPermi="['system:config:add']"
|
||||
icon="el-icon-plus"
|
||||
plain
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>新建
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPermi="['system:config:delete']"
|
||||
:disabled="multiple"
|
||||
icon="el-icon-plus"
|
||||
plain
|
||||
size="mini"
|
||||
type="info"
|
||||
@click="handleDelete"
|
||||
>批量删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
<el-table v-loading="loading" :data="INFOList" @selection-change="handleSelectionChange">
|
||||
<el-table-column align="center" type="selection" width="55"/>
|
||||
<template v-if="activeTabs=='1'">
|
||||
<el-table-column align="center" label="上传类型" prop="uploadingType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_apk_uploading_type" :value="scope.row.uploadingType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="安装包名称" prop="sysApkName"/>
|
||||
<el-table-column align="center" label="版本号" prop="version"/>
|
||||
<el-table-column align="center" label="安装包" prop="sysApk"/>
|
||||
<el-table-column align="center" label="安装包大小" prop="sysApkSize"/>
|
||||
<el-table-column align="center" label="安装包类型" prop="sysType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_apk_type" :value="scope.row.sysType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建人" prop="created"/>
|
||||
</template>
|
||||
<template v-if="activeTabs=='2'">
|
||||
<el-table-column align="center" label="安装包名称" prop="configId"/>
|
||||
<el-table-column :show-overflow-tooltip="true" align="center" label="版本号" prop="version"/>
|
||||
<el-table-column :show-overflow-tooltip="true" align="center" label="安装包大小" prop="sys_apk_size"/>
|
||||
<el-table-column :show-overflow-tooltip="true" align="center" label="上传方式" prop="uploading_type"/>
|
||||
<el-table-column :show-overflow-tooltip="true" align="center" label="创建人" prop="created"/>
|
||||
<el-table-column align="center" label="创建时间" prop="create_time" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column align="center" label="状态" prop="uploading_status">
|
||||
<template slot-scope="scopeA">
|
||||
<dict-tag :options="dict.type.sys_yes_no" :value="scopeA.row.type"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="250">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-hasPermi="['system:config:dowmload']"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleDownload(scope.row)"
|
||||
>下载安装包
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['system:config:edit']"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleEdit(scope.row)"
|
||||
>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['system:config:detail']"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleDetail(scope.row)"
|
||||
>详情
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['system:config:delete']"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// import { listINFO, getINFO, delINFO, addINFO, updateINFO } from "@/api/deploy/INFO";
|
||||
export default {
|
||||
name: 'InstallationList',
|
||||
dicts: ['sys_yes_no'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 安装包管理(新)表格数据
|
||||
INFOList: [],
|
||||
packTabs: [{
|
||||
name: '1',
|
||||
title: 'APP安装包'
|
||||
}, {
|
||||
name: '2',
|
||||
title: 'H5模块包'
|
||||
}],
|
||||
// 日期范围
|
||||
create_time: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
uploadingType: null,
|
||||
sysApkName: null,
|
||||
version: null,
|
||||
sysType: null,
|
||||
uploadingStatus: null,
|
||||
created: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
activeTabs: '1'
|
||||
// 表单校验
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询安装包管理(新)列表 */
|
||||
getList() {
|
||||
this.loading = false
|
||||
// listINFO(this.queryParams).then(response => {
|
||||
// this.INFOList = response.rows
|
||||
// this.total = response.total
|
||||
// this.loading = false
|
||||
// })
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.create_time = []
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.$router.push({
|
||||
path: 'install/add',
|
||||
params: {
|
||||
type: 'add',
|
||||
activeTabs: this.activeTabs
|
||||
}
|
||||
})
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length != 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const configIds = row.id || this.ids
|
||||
this.$modal.confirm('是否确认删除编号为"' + configIds + '"的数据项?').then(function() {
|
||||
return delConfig(configIds)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleEdit(row) {
|
||||
this.reset()
|
||||
const configId = row.id || this.ids
|
||||
getConfig(configId).then(response => {
|
||||
this.form = response.data
|
||||
this.$router.push({
|
||||
path: 'install/add',
|
||||
params: {
|
||||
type: 'edit',
|
||||
activeTabs: this.activeTabs
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
/** 查看详情弹窗 **/
|
||||
handleDetail() {
|
||||
this.$router.push({
|
||||
path: 'install/detail',
|
||||
params: {
|
||||
activeTabs: this.activeTabs
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** 切换TAB触发的事件 */
|
||||
handleClickTabs() {
|
||||
this.getList()
|
||||
},
|
||||
|
||||
/** 下载按钮 */
|
||||
handleDownload(row) {
|
||||
const configIds = row.id || this.ids
|
||||
this.$modal.confirm('是否确认下载编号为"' + configIds + '"的数据项?').then(function() {
|
||||
return delConfig(configIds)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('下载成功')
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
/** 关闭新增弹出框*/
|
||||
closeAdd() {
|
||||
this.addOpen = false
|
||||
this.getList()
|
||||
},
|
||||
closeAddConfig() {
|
||||
this.detailOpen = false
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
348
sf-ui/src/views/goods/goods/index.vue
Normal file
348
sf-ui/src/views/goods/goods/index.vue
Normal file
@ -0,0 +1,348 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="商品编号" prop="goodsCode">
|
||||
<el-input
|
||||
v-model="queryParams.goodsCode"
|
||||
placeholder="请输入商品编号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品标题" prop="productTitle">
|
||||
<el-input
|
||||
v-model="queryParams.productTitle"
|
||||
placeholder="请输入商品标题"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品类型" prop="goodsType">
|
||||
<el-select v-model="queryParams.goodsType" placeholder="请选择商品类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.goods_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['goods:goods:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['goods:goods:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['goods:goods:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['goods:goods:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="goodsList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="商品id" align="center" prop="id" />
|
||||
<el-table-column label="商品编号" align="center" prop="goodsCode" />
|
||||
<el-table-column label="商品标题" align="center" prop="productTitle" />
|
||||
<el-table-column label="商品图片" align="center" prop="productPicture" width="100">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.productPicture" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="价格" align="center" prop="originalPrice" />
|
||||
<el-table-column label="商品描述" align="center" prop="productDesc" />
|
||||
<el-table-column label="排序" align="center" prop="orderNum" />
|
||||
<el-table-column label="商品类型" align="center" prop="goodsType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.goods_type" :value="scope.row.goodsType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品规格" align="center" prop="goodsSpec" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['goods:goods:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['goods:goods:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改商品信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="商品编号" prop="goodsCode">
|
||||
<el-input v-model="form.goodsCode" placeholder="请输入商品编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品标题" prop="productTitle">
|
||||
<el-input v-model="form.productTitle" placeholder="请输入商品标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品图片" prop="productPicture">
|
||||
<image-upload v-model="form.productPicture"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="原价格" prop="originalPrice">
|
||||
<el-input v-model="form.originalPrice" placeholder="请输入原价格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品描述" prop="productDesc">
|
||||
<el-input v-model="form.productDesc" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="orderNum">
|
||||
<el-input v-model="form.orderNum" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品类型" prop="goodsType">
|
||||
<el-radio-group v-model="form.goodsType">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.goods_type"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品规格" prop="goodsSpec">
|
||||
<el-input v-model="form.goodsSpec" placeholder="请输入商品规格" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listGoods, getGoods, delGoods, addGoods, updateGoods } from "@/api/goods/goods";
|
||||
|
||||
export default {
|
||||
name: "Goods",
|
||||
dicts: ['sys_notice_status', 'goods_type'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 商品信息表格数据
|
||||
goodsList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
goodsCode: null,
|
||||
productTitle: null,
|
||||
goodsType: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
goodsCode: [
|
||||
{ required: true, message: "商品编号不能为空", trigger: "blur" }
|
||||
],
|
||||
productTitle: [
|
||||
{ required: true, message: "商品标题不能为空", trigger: "blur" }
|
||||
],
|
||||
productPicture: [
|
||||
{ required: true, message: "商品图片不能为空", trigger: "blur" }
|
||||
],
|
||||
originalPrice: [
|
||||
{ required: true, message: "原价格不能为空", trigger: "blur" }
|
||||
],
|
||||
orderNum: [
|
||||
{ required: true, message: "排序不能为空", trigger: "blur" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||
],
|
||||
goodsType: [
|
||||
{ required: true, message: "商品类型不能为空", trigger: "change" }
|
||||
],
|
||||
goodsSpec: [
|
||||
{ required: true, message: "商品规格不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询商品信息列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listGoods(this.queryParams).then(response => {
|
||||
this.goodsList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
goodsCode: null,
|
||||
stockId: null,
|
||||
reviewStatus: null,
|
||||
productTitle: null,
|
||||
productPicture: null,
|
||||
originalPrice: null,
|
||||
productDesc: null,
|
||||
orderNum: null,
|
||||
isDelete: null,
|
||||
created: null,
|
||||
modified: null,
|
||||
createTime: null,
|
||||
updateTime: null,
|
||||
goodsType: null,
|
||||
goodsSpec: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加商品信息";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getGoods(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改商品信息";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
let data = Object.assign({},this.form)
|
||||
delete data.explain
|
||||
updateGoods(data).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addGoods(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除商品信息编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delGoods(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('goods/goods/export', {
|
||||
...this.queryParams
|
||||
}, `goods_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user