diff --git a/.gitignore b/.gitignore index b83d222..7425e2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,11 @@ -/target/ +### IDEA ### +/target/**/* +/log/* +.idea/* +*.iml +*/target/* +*/*.iml +/.gradle/ +/application.pid +/target/* +**.jar \ No newline at end of file diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java index c6f5a8a..1f2a610 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java @@ -1,36 +1,33 @@ package com.chaozhanggui.system.cashierservice.dao; import com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; -import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Component; -/** -* @author Administrator -* @description 针对表【tb_user_shop_msg】的数据库操作Mapper -* @createDate 2024-06-28 09:55:30 -* @Entity com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg -*/ @Component @Mapper public interface TbUserShopMsgMapper { - int deleteByPrimaryKey(Integer shopId); - - int deleteByPrimaryKey(Long id); + int deleteByPrimaryKey(Integer id); int insert(TbUserShopMsg record); int insertSelective(TbUserShopMsg record); - TbUserShopMsg selectByPrimaryKey(Integer shopId); - TbUserShopMsg selectByPrimaryKey(Long id); + TbUserShopMsg selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(TbUserShopMsg record); int updateByPrimaryKey(TbUserShopMsg record); + @Select("select * from tb_user_shop_msg where shop_id=#{shopId}") TbUserShopMsg selectByShopId(@Param("shopId") String shopId); + + TbUserShopMsg selectByShopIdAndOpenId(@Param("shopId") Integer shopId,@Param("openId") String openId); } + + + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java index 22c4663..e1bedc8 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java @@ -4,6 +4,8 @@ import java.io.Serializable; import java.util.Date; public class TbUserShopMsg implements Serializable { + private Integer id; + private Integer shopId; private String openId; @@ -18,6 +20,14 @@ public class TbUserShopMsg implements Serializable { private static final long serialVersionUID = 1L; + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + public Integer getShopId() { return shopId; } @@ -65,4 +75,4 @@ public class TbUserShopMsg implements Serializable { public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } -} +} \ No newline at end of file diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java index a36fb42..3f87abb 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java @@ -65,22 +65,16 @@ public class LoginService { public Result wxBusinessLogin(String openId,String shopId){ - TbUserShopMsg shopMsg= tbUserShopMsgMapper.selectByPrimaryKey(Integer.valueOf(shopId)); + TbUserShopMsg shopMsg= tbUserShopMsgMapper.selectByShopIdAndOpenId(Integer.valueOf(shopId),openId); if(Objects.isNull(shopMsg)){ shopMsg=new TbUserShopMsg(); - shopMsg.setShopId(Integer.valueOf(shopId)); shopMsg.setOpenId(openId); shopMsg.setCreateTime(new Date()); shopMsg.setStatus("1"); - - tbUserShopMsgMapper.insert(shopMsg); - }else { - shopMsg.setOpenId(openId); - shopMsg.setUpdateTime(new Date()); - tbUserShopMsgMapper.updateByPrimaryKey(shopMsg); } + // 为商家绑定openid if (shopOpenIdMapper.countByOpenId(openId) == null) { TbShopOpenId shopOpenId = new TbShopOpenId(); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d784451..9ef5971 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -59,18 +59,19 @@ logging: file: # 切记,该文件表示正在产出日志的日志文件。并不会打包,当文件大于max-file-size,会根据file-name-pattern格式打包 # 名称为log/cashier-client.log文件夹会在项目根目录下,打包后会在启动包同目录下;名称为/log/cashier-client.log的文件夹会在项目所在磁盘的跟目录下 - name: log/cashierService.log + name: wx.log logback: rollingpolicy: # 单文件的大小,默认10M, 超过之后打包成一个日志文件 - max-file-size: 10MB + max-file-size: 50MB # 日志保存的天数 max-history: 30 # 打包文件格式,默认: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz,书写格式为:文件路径/文件名.%i.文件后缀,其中%i不可省去,否则无日志显示 # 例如: 日期为:2021/11/5 ,则打包文件之后为: log/ota.2021-11-05.0.gz,0表示日志的第一部分,后续就是,1,2,3... # 如果是压缩包,里面会多一个名log/ota.2021-11-05.0的日志文件 # 如下面的例子,打包之后为: log/2021-11/cashier-client.2020-11-5.0.log,这是一个日志文件 - file-name-pattern: log/%d{yyyy-MM}/cashierService.%d{yyyy-MM-dd}.%i.log +# file-name-pattern: log/%d{yyyy-MM}/cashierService.%d{yyyy-MM-dd}.%i.log + file-name-pattern: log/%d{yyyy-MM}/cashierService.%d{yyyy-MM-dd}.%i.log.gz #阿里云相关配置 aliyun: keyid: LTAI5tPdEfYSZcqHbjCrtPRD diff --git a/src/main/resources/generator-mapper/generatorConfig.xml b/src/main/resources/generator-mapper/generatorConfig.xml index a6c8bea..007174a 100644 --- a/src/main/resources/generator-mapper/generatorConfig.xml +++ b/src/main/resources/generator-mapper/generatorConfig.xml @@ -52,7 +52,7 @@ -
diff --git a/src/main/resources/mapper/TbUserShopMsgMapper.xml b/src/main/resources/mapper/TbUserShopMsgMapper.xml index 25fdc4c..3220910 100644 --- a/src/main/resources/mapper/TbUserShopMsgMapper.xml +++ b/src/main/resources/mapper/TbUserShopMsgMapper.xml @@ -2,7 +2,8 @@ - + + @@ -10,29 +11,32 @@ - shop_id, open_id, remark, status, create_time, update_time + id, shop_id, open_id, remark, status, create_time, update_time delete from tb_user_shop_msg - where shop_id = #{shopId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} - insert into tb_user_shop_msg (shop_id, open_id, remark, - status, create_time, update_time - ) - values (#{shopId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, - #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} - ) + insert into tb_user_shop_msg (id, shop_id, open_id, + remark, status, create_time, + update_time) + values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, + #{remark,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}) insert into tb_user_shop_msg + + id, + shop_id, @@ -53,6 +57,9 @@ + + #{id,jdbcType=INTEGER}, + #{shopId,jdbcType=INTEGER}, @@ -76,6 +83,9 @@ update tb_user_shop_msg + + shop_id = #{shopId,jdbcType=INTEGER}, + open_id = #{openId,jdbcType=VARCHAR}, @@ -92,15 +102,20 @@ update_time = #{updateTime,jdbcType=TIMESTAMP}, - where shop_id = #{shopId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} update tb_user_shop_msg - set open_id = #{openId,jdbcType=VARCHAR}, + set shop_id = #{shopId,jdbcType=INTEGER}, + open_id = #{openId,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR}, status = #{status,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} - where shop_id = #{shopId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} - + + + \ No newline at end of file