商品模块重复字段删除

消费者模块添加
This commit is contained in:
clunt 2022-03-22 14:46:05 +08:00
parent bb09235bf6
commit 36d34a84ce
9 changed files with 170 additions and 3 deletions

28
ghy-custom/pom.xml Normal file
View File

@ -0,0 +1,28 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ghy</artifactId>
<groupId>com.ghy</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ghy-custom</artifactId>
<description>
消费者模块
</description>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>com.ghy</groupId>
<artifactId>ghy-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,36 @@
package com.ghy.customer.domain;
import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity;
import lombok.Data;
/**
* @author clunt
* 消费者实体
*/
@Data
public class Customer extends BaseEntity {
@Excel(name = "用户id", cellType = Excel.ColumnType.NUMERIC)
private Long customerId;
@Excel(name = "用户名", cellType = Excel.ColumnType.STRING)
private String name;
@Excel(name = "用户微信账号", cellType = Excel.ColumnType.STRING)
private String account;
@Excel(name = "用户手机号", cellType = Excel.ColumnType.STRING)
private String phone;
@Excel(name = "微信open_id", cellType = Excel.ColumnType.STRING)
private String openId;
@Excel(name = "用户状态 0生效 1冻结 2删除", readConverterExp = "0=生效,1=冻结,2=删除")
private Integer status;
@Excel(name = "用户头像", cellType = Excel.ColumnType.STRING)
private String customerLogoUrl;
}

View File

@ -0,0 +1,7 @@
package com.ghy.customer.mapper;
public interface CustomerMapper {
}

View File

@ -0,0 +1,4 @@
package com.ghy.customer.service;
public interface CustomerService {
}

View File

@ -0,0 +1,11 @@
package com.ghy.customer.service.impl;
import com.ghy.customer.service.CustomerService;
import org.springframework.stereotype.Service;
@Service
public class CustomerServiceImpl implements CustomerService {
}

View File

@ -0,0 +1,70 @@
<?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.ghy.customer.mapper.CustomerMapper">
<resultMap id="GoodsImgsResult" type="com.ghy.customer.domain.Customer">
<!-- 消费者属性 -->
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectGoodsImgs">
SELECT goods_imgs_id, goods_id, img_url, create_by, create_time, remark
FROM goods_imgs
</sql>
<delete id="delete">
DELETE FROM goods_imgs WHERE goods_imgs_id IN
<foreach collection="array" item="goodsImgsId" open="(" separator="," close=")">
#{goodsImgsId}
</foreach>
</delete>
<delete id="deleteByGoodsId">
DELETE FROM goods_imgs WHERE goods_id = #{goodsId}
</delete>
<select id="selectByGoodsId" resultType="com.ghy.goods.domain.GoodsImgs">
<include refid="selectGoodsImgs"/>
<where>
<if test="goodsId != null and goodsId != 0">
AND goods_id = #{goodsId}
</if>
</where>
</select>
<insert id="batchInsert" parameterType="com.ghy.goods.domain.GoodsImgs" useGeneratedKeys="true" keyProperty="goodsImgsId">
<foreach collection="array" item="goodsImgs">
INSERT INTO goods_imgs(
<if test="goodsImgsId != null and goodsImgsId != 0">goods_imgs_id,</if>
<if test="goodsId != null and goodsId != 0">goods_id,</if>
<if test="imgUrl != null and imgUrl != ''">img_url,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time)
VALUES(
<if test="goodsImgsId != null and goodsImgsId != 0">#{goodsImgsId},</if>
<if test="goodsId != null and goodsId != 0">#{goodsId},</if>
<if test="imgUrl != null and imgUrl != ''">#{imgUrl},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate());
</foreach>
</insert>
<update id="batchUpdate" parameterType="com.ghy.goods.domain.GoodsImgs">
<foreach collection="array" item="goodsImgs">
UPDATE goods_imgs
<set>
<if test="goodsId != null and goodsId != ''">goods_id = #{goodsId},</if>
<if test="imgUrl != null and imgUrl != ''">img_url = #{imgUrl},</if>
update_time = sysdate()
</set>
WHERE goods_imgs_id = #{goodsImgsId};
</foreach>
</update>
</mapper>

View File

@ -0,0 +1,13 @@
package com.ghy.customer;
//import org.junit.jupiter.api.Test;
//import org.springframework.boot.test.context.SpringBootTest;
//@SpringBootTest
class CustomerApplicationTests {
// @Test
void contextLoads() {
}
}

View File

@ -51,7 +51,4 @@ public class Goods extends BaseEntity {
@Excel(name = "商品库存,-1则表示无限制", cellType = Excel.ColumnType.NUMERIC) @Excel(name = "商品库存,-1则表示无限制", cellType = Excel.ColumnType.NUMERIC)
private Integer goodsNumber; private Integer goodsNumber;
@Excel(name = "描述")
private String remark;
} }

View File

@ -274,6 +274,7 @@
<module>ghy-quartz</module> <module>ghy-quartz</module>
<module>ghy-generator</module> <module>ghy-generator</module>
<module>ghy-common</module> <module>ghy-common</module>
<module>ghy-custom</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>