Commit ebea8be4 by weijiguang

下单时校验订单中sku数量

parent d6a97012
...@@ -9,6 +9,7 @@ import com.soss.framework.web.service.TokenService; ...@@ -9,6 +9,7 @@ import com.soss.framework.web.service.TokenService;
import com.soss.framework.web.service.WeixinServiceImpl; import com.soss.framework.web.service.WeixinServiceImpl;
import com.soss.system.domain.Customer; import com.soss.system.domain.Customer;
import com.soss.system.domain.Shop; import com.soss.system.domain.Shop;
import com.soss.system.domain.po.LocationPo;
import com.soss.system.service.ICustomerService; import com.soss.system.service.ICustomerService;
import com.soss.system.service.impl.AppServiceImpl; import com.soss.system.service.impl.AppServiceImpl;
import com.soss.system.service.impl.OrderTakingServiceImpl; import com.soss.system.service.impl.OrderTakingServiceImpl;
...@@ -113,12 +114,11 @@ public class WeixinController { ...@@ -113,12 +114,11 @@ public class WeixinController {
testFlag = customer.getTestFlag(); testFlag = customer.getTestFlag();
} }
} }
Shop shop = appService.getShop(loginUser, lng, lat, testFlag); return AjaxResult.success(appService.getShop(loginUser, lng, lat, testFlag));
return AjaxResult.success(shop);
} }
@RequestMapping("/v2/getLocationShops") @RequestMapping("/v2/getLocationShops")
public AjaxResult getSameLocationShops(HttpServletRequest request, @RequestParam(required = false) String lng, @RequestParam(required = false) String lat) throws ParseException { public AjaxResult getSameLocationShops(HttpServletRequest request, @RequestBody LocationPo locationPo) throws ParseException {
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
boolean testFlag = false; boolean testFlag = false;
if (loginUser != null) { if (loginUser != null) {
...@@ -127,8 +127,7 @@ public class WeixinController { ...@@ -127,8 +127,7 @@ public class WeixinController {
testFlag = customer.getTestFlag(); testFlag = customer.getTestFlag();
} }
} }
Shop shop = appService.getShop(loginUser, lng, lat, testFlag); return AjaxResult.success(appService.getSameLocationShops(loginUser, locationPo, testFlag));
return AjaxResult.success(shop);
} }
@RequestMapping("/getShop") @RequestMapping("/getShop")
...@@ -145,7 +144,7 @@ public class WeixinController { ...@@ -145,7 +144,7 @@ public class WeixinController {
} }
@RequestMapping("/getArea") @RequestMapping("/getArea")
public AjaxResult getArea(HttpServletRequest request, @RequestParam(required = false) String lng, @RequestParam(required = false) String lat) { public AjaxResult getArea(HttpServletRequest request, @RequestParam(required = false) String lng, @RequestParam(required = false) String lat) throws ParseException {
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
List<JSONObject> area; List<JSONObject> area;
if (loginUser == null || StringUtils.isEmpty(loginUser.getOpenId())) { if (loginUser == null || StringUtils.isEmpty(loginUser.getOpenId())) {
...@@ -157,7 +156,6 @@ public class WeixinController { ...@@ -157,7 +156,6 @@ public class WeixinController {
return AjaxResult.success(area); return AjaxResult.success(area);
} }
@GetMapping(value = "/infoByShop") @GetMapping(value = "/infoByShop")
public AjaxResult infoByShop(Long shopId) { public AjaxResult infoByShop(Long shopId) {
return AjaxResult.success(orderTakingService.getInfoByShop(shopId)); return AjaxResult.success(orderTakingService.getInfoByShop(shopId));
......
...@@ -31,6 +31,7 @@ import com.soss.system.mapper.CustomerMapper; ...@@ -31,6 +31,7 @@ import com.soss.system.mapper.CustomerMapper;
import com.soss.system.mapper.OrderDetailMapper; import com.soss.system.mapper.OrderDetailMapper;
import com.soss.system.mapper.OrderRefundMapper; import com.soss.system.mapper.OrderRefundMapper;
import com.soss.system.mapper.ShopMapper; import com.soss.system.mapper.ShopMapper;
import com.soss.system.service.impl.AppServiceImpl;
import com.soss.system.service.impl.OrderOperationLogServiceImpl; import com.soss.system.service.impl.OrderOperationLogServiceImpl;
import com.soss.system.service.impl.OrderServiceImpl; import com.soss.system.service.impl.OrderServiceImpl;
import com.soss.system.utils.DistanceUtil; import com.soss.system.utils.DistanceUtil;
...@@ -65,6 +66,7 @@ import java.math.BigDecimal; ...@@ -65,6 +66,7 @@ import java.math.BigDecimal;
import java.net.InetAddress; import java.net.InetAddress;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
...@@ -94,6 +96,8 @@ public class WeixinServiceImpl { ...@@ -94,6 +96,8 @@ public class WeixinServiceImpl {
private ShopMapper shopMapper; private ShopMapper shopMapper;
@Autowired @Autowired
private OssFileServiceImpl ossFileService; private OssFileServiceImpl ossFileService;
@Autowired
private AppServiceImpl appService;
private final ReentrantLock lock = new ReentrantLock(); private final ReentrantLock lock = new ReentrantLock();
...@@ -624,7 +628,7 @@ public class WeixinServiceImpl { ...@@ -624,7 +628,7 @@ public class WeixinServiceImpl {
return WxPayNotifyResponse.fail("回调有误!"); return WxPayNotifyResponse.fail("回调有误!");
} }
public List<JSONObject> getArea(String lng, String lat, Boolean testFlag) { public List<JSONObject> getArea(String lng, String lat, Boolean testFlag) throws ParseException {
String provinceString ="[value ='%s'][0].label"; String provinceString ="[value ='%s'][0].label";
String cityString ="[value='%s'][0].children[value='%s'][0].label"; String cityString ="[value='%s'][0].children[value='%s'][0].label";
String zoneString = "[value='%s'][0].children[value='%s'][0].children[value='%s'][0].label"; String zoneString = "[value='%s'][0].children[value='%s'][0].children[value='%s'][0].label";
...@@ -642,8 +646,10 @@ public class WeixinServiceImpl { ...@@ -642,8 +646,10 @@ public class WeixinServiceImpl {
double realDistance = DistanceUtil.getRealDistance(Double.parseDouble(lng), Double.parseDouble(lat), Double.parseDouble(shop1.getLng()), Double.parseDouble(shop1.getLat())); double realDistance = DistanceUtil.getRealDistance(Double.parseDouble(lng), Double.parseDouble(lat), Double.parseDouble(shop1.getLng()), Double.parseDouble(shop1.getLat()));
shop1.setRealDistance(realDistance); shop1.setRealDistance(realDistance);
shop1.setDistance(DistanceUtil.getDistanceDesc(realDistance)); shop1.setDistance(DistanceUtil.getDistanceDesc(realDistance));
appService.perfectOrderState(shop1, lng, lat);
} else { } else {
shop1.setDistance("-1"); shop1.setDistance("-1");
shop1.setOrderState(1);
} }
String province = shop1.getProvince(); String province = shop1.getProvince();
if(proString.contains(province)){ if(proString.contains(province)){
......
package com.soss.system.domain.po;
import com.soss.common.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel("优惠券请求类")
public class LocationPo {
private String lng;
private String lat;
private String province;
private String city;
private String area;
public boolean isEmpty() {
return StringUtils.isEmpty(lng) || StringUtils.isEmpty(lat) || StringUtils.isEmpty(province) || StringUtils.isEmpty(city) || StringUtils.isEmpty(area);
}
}
package com.soss.system.domain.vo;
import com.soss.common.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel("优惠券请求类")
public class LocationVo {
private String lng;
private String lat;
private String province;
private String city;
private String area;
private String provinceCode;
private String cityCode;
private String areaCode;
}
package com.soss.system.mapper; package com.soss.system.mapper;
import com.soss.system.domain.Shop; import com.soss.system.domain.Shop;
import com.soss.system.domain.vo.LocationVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
* 店铺Mapper接口 * 店铺Mapper接口
* *
* @author zxq * @author zxq
* @date 2022-04-28 * @date 2022-04-28
*/ */
...@@ -53,7 +54,7 @@ public interface ShopMapper { ...@@ -53,7 +54,7 @@ public interface ShopMapper {
/** /**
* 修改店铺 * 修改店铺
* *
* @param shop 店铺 * @param shop 店铺
* @return 结果 * @return 结果
*/ */
...@@ -61,7 +62,7 @@ public interface ShopMapper { ...@@ -61,7 +62,7 @@ public interface ShopMapper {
/** /**
* 删除店铺 * 删除店铺
* *
* @param id 店铺主键 * @param id 店铺主键
* @return 结果 * @return 结果
*/ */
...@@ -69,7 +70,7 @@ public interface ShopMapper { ...@@ -69,7 +70,7 @@ public interface ShopMapper {
/** /**
* 批量删除店铺 * 批量删除店铺
* *
* @param ids 需要删除的数据主键集合 * @param ids 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
...@@ -77,5 +78,9 @@ public interface ShopMapper { ...@@ -77,5 +78,9 @@ public interface ShopMapper {
void updateNoDefault(); void updateNoDefault();
List<Shop> selectEnableShops(); List<Shop> selectEnableShops(List<Integer> states);
List<Shop> selectDefaultSameLocationShops(@Param("states") List<Integer> states);
List<Shop> selectSameLocationShops(@Param("states") List<Integer> states, @Param("location") LocationVo locationVo);
} }
...@@ -6,7 +6,10 @@ import com.soss.common.utils.DateUtils; ...@@ -6,7 +6,10 @@ import com.soss.common.utils.DateUtils;
import com.soss.common.utils.StringUtils; import com.soss.common.utils.StringUtils;
import com.soss.system.domain.Order; import com.soss.system.domain.Order;
import com.soss.system.domain.Shop; import com.soss.system.domain.Shop;
import com.soss.system.domain.po.LocationPo;
import com.soss.system.domain.vo.LocationVo;
import com.soss.system.mapper.ShopMapper; import com.soss.system.mapper.ShopMapper;
import com.soss.system.utils.AreaUtil;
import com.soss.system.utils.DistanceUtil; import com.soss.system.utils.DistanceUtil;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -26,12 +29,13 @@ public class AppServiceImpl { ...@@ -26,12 +29,13 @@ public class AppServiceImpl {
private ShopServiceImpl shopService; private ShopServiceImpl shopService;
@Autowired @Autowired
private OrderServiceImpl orderService; private OrderServiceImpl orderService;
@Autowired
private AreaUtil areaUtil;
public Shop getShop(LoginUser loginUser, String lng, String lat, Boolean testFlag) throws ParseException { public Shop getShop(LoginUser loginUser, String lng, String lat, Boolean testFlag) throws ParseException {
Shop shop = null; Shop shop = null;
if (StringUtils.isEmpty(lng) || StringUtils.isEmpty(lat)) { if (StringUtils.isEmpty(lng) || StringUtils.isEmpty(lat)) {
// 未授权位置 // 未授权位置
if (loginUser == null) { if (loginUser == null) {
// 未登录,返回默认店铺 // 未登录,返回默认店铺
shop = getDefaultShop(); shop = getDefaultShop();
...@@ -49,7 +53,14 @@ public class AppServiceImpl { ...@@ -49,7 +53,14 @@ public class AppServiceImpl {
} }
} else { } else {
// 授权了位置 // 授权了位置
List<Shop> shops = shopMapper.selectEnableShops(); // 获取所有非关闭的店铺 List<Integer> states = null;
if (BooleanUtils.isTrue(testFlag)) {
states = Arrays.asList(ShopState.TESTING.getState(), ShopState.OPEN.getState());
} else {
states = Arrays.asList(ShopState.OPEN.getState(), ShopState.CLOSE.getState());
}
List<Shop> shops = shopMapper.selectEnableShops(states); // 获取所有非关闭的店铺
if (CollectionUtils.isEmpty(shops)) { if (CollectionUtils.isEmpty(shops)) {
return null; return null;
} }
...@@ -75,7 +86,7 @@ public class AppServiceImpl { ...@@ -75,7 +86,7 @@ public class AppServiceImpl {
return shop; return shop;
} }
private boolean perfectOrderState(Shop shop, String lng, String lat) throws ParseException { public boolean perfectOrderState(Shop shop, String lng, String lat) throws ParseException {
if (shop == null) { if (shop == null) {
return false; return false;
} }
...@@ -110,6 +121,42 @@ public class AppServiceImpl { ...@@ -110,6 +121,42 @@ public class AppServiceImpl {
return true; return true;
} }
public List<Shop> getSameLocationShops(LoginUser loginUser, LocationPo locationPo, Boolean testFlag) throws ParseException {
List<Integer> states = null;
if (BooleanUtils.isTrue(testFlag)) {
states = Arrays.asList(ShopState.TESTING.getState(), ShopState.OPEN.getState());
} else {
states = Arrays.asList(ShopState.OPEN.getState(), ShopState.CLOSE.getState());
}
List<Shop> shops = null;
if (locationPo == null || locationPo.isEmpty()) {
// 未授权位置,返回默认店铺相同区域的所有店铺
shops = shopMapper.selectDefaultSameLocationShops(states);
} else {
// 授权了位置
LocationVo locationVo = areaUtil.translateLocation(locationPo);
if (locationVo == null) {
shops = shopMapper.selectDefaultSameLocationShops(states);
} else {
shops = shopMapper.selectSameLocationShops(states, locationVo);
}
}
if (CollectionUtils.isEmpty(shops)) {
return null;
}
for (Shop s : shops) { // 获取所有店铺距离
double realDistance = DistanceUtil.getRealDistance(Double.parseDouble(locationPo.getLng()), Double.parseDouble(locationPo.getLat()), Double.parseDouble(s.getLng()), Double.parseDouble(s.getLat()));
s.setRealDistance(realDistance);
perfectOrderState(s, locationPo.getLng(), locationPo.getLat());
}
shops.sort(Comparator.comparing(Shop::getRealDistance)); // 按距离排序
return shops;
}
public Shop getShop(LoginUser loginUser) { public Shop getShop(LoginUser loginUser) {
if (loginUser == null) { if (loginUser == null) {
// 未登录,返回默认店铺 // 未登录,返回默认店铺
......
...@@ -2,6 +2,8 @@ package com.soss.system.utils; ...@@ -2,6 +2,8 @@ package com.soss.system.utils;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.soss.system.domain.po.LocationPo;
import com.soss.system.domain.vo.LocationVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -20,6 +22,7 @@ public class AreaUtil { ...@@ -20,6 +22,7 @@ public class AreaUtil {
// private Map<String, Area> areaMap; // private Map<String, Area> areaMap;
private Map<String, String> provNameMap = new HashMap<>(); private Map<String, String> provNameMap = new HashMap<>();
private Map<String, String> areaOrCityFullNameMap = new HashMap<>(); private Map<String, String> areaOrCityFullNameMap = new HashMap<>();
private static JSONArray DATA;
@PostConstruct @PostConstruct
public void init() { public void init() {
...@@ -27,15 +30,17 @@ public class AreaUtil { ...@@ -27,15 +30,17 @@ public class AreaUtil {
ClassPathResource resource = new ClassPathResource("province.json"); ClassPathResource resource = new ClassPathResource("province.json");
byte[] bdata = FileCopyUtils.copyToByteArray(resource.getInputStream()); byte[] bdata = FileCopyUtils.copyToByteArray(resource.getInputStream());
String data = new String(bdata, StandardCharsets.UTF_8); String data = new String(bdata, StandardCharsets.UTF_8);
JSONArray areaArray = JSONArray.parseArray(data); if (DATA == null) {
DATA = JSONArray.parseArray(data);
}
// areaMap = buildAreaTree(areaArray); // areaMap = buildAreaTree(areaArray);
deepAreaTree(areaArray, ""); deepAreaTree(DATA, "", 0);
} catch (IOException e) { } catch (IOException e) {
log.error("解析区域文件出错", e); log.error("解析区域文件出错", e);
} }
} }
private void deepAreaTree(JSONArray areaArray, String parentName) { private void deepAreaTree(JSONArray areaArray, String parentName, Integer deep) {
if (CollectionUtils.isEmpty(areaArray)) { if (CollectionUtils.isEmpty(areaArray)) {
return; return;
} }
...@@ -50,7 +55,7 @@ public class AreaUtil { ...@@ -50,7 +55,7 @@ public class AreaUtil {
areaOrCityFullNameMap.put(code, curLabel); areaOrCityFullNameMap.put(code, curLabel);
} }
JSONArray children = area.getJSONArray("children"); JSONArray children = area.getJSONArray("children");
deepAreaTree(children, curLabel); deepAreaTree(children, curLabel, deep + 1);
} }
} }
...@@ -62,6 +67,46 @@ public class AreaUtil { ...@@ -62,6 +67,46 @@ public class AreaUtil {
return areaOrCityFullNameMap.get(code); return areaOrCityFullNameMap.get(code);
} }
public LocationVo translateLocation(LocationPo locationPo) {
if (locationPo == null || locationPo.isEmpty()) {
return null;
}
for (int i = 0; i < DATA.size(); i++) {
JSONObject provinceObj = DATA.getJSONObject(i);
String provinceName = provinceObj.getString("label");
String provinceCode = provinceObj.getString("value");
if (!provinceName.equals(locationPo.getProvince())) {
continue;
}
JSONArray cityArray = provinceObj.getJSONArray("children");
for (int j = 0; j < cityArray.size(); j++) {
JSONObject cityObj = cityArray.getJSONObject(j);
String cityName = cityObj.getString("label");
String cityCode = cityObj.getString("value");
if (!cityName.equals(locationPo.getCity())) {
continue;
}
JSONArray areaArray = cityObj.getJSONArray("children");
for (int k = 0; k < areaArray.size(); k++) {
JSONObject areaObj = areaArray.getJSONObject(k);
String areaName = areaObj.getString("label");
String areaCode = areaObj.getString("value");
if (!areaName.equals(locationPo.getArea())) {
continue;
}
LocationVo locationVo = new LocationVo();
locationVo.setProvinceCode(provinceCode);
locationVo.setCityCode(cityCode);
locationVo.setAreaCode(areaCode);
return locationVo;
}
}
}
return null;
}
/*private Map<String, Area> buildAreaTree(JSONArray areaArray) { /*private Map<String, Area> buildAreaTree(JSONArray areaArray) {
if (CollectionUtils.isEmpty(areaArray)) { if (CollectionUtils.isEmpty(areaArray)) {
return null; return null;
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.soss.system.mapper.ShopMapper"> <mapper namespace="com.soss.system.mapper.ShopMapper">
<resultMap type="Shop" id="ShopResult"> <resultMap type="Shop" id="ShopResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="code" column="code" /> <result property="code" column="code"/>
<result property="lng" column="lng" /> <result property="lng" column="lng"/>
<result property="lat" column="lat" /> <result property="lat" column="lat"/>
<result property="remarks" column="remarks" /> <result property="remarks" column="remarks"/>
<result property="startTime" column="start_time" /> <result property="startTime" column="start_time"/>
<result property="endTime" column="end_time" /> <result property="endTime" column="end_time"/>
<result property="address" column="address" /> <result property="address" column="address"/>
<result property="province" column="province" /> <result property="province" column="province"/>
<result property="city" column="city" /> <result property="city" column="city"/>
<result property="zone" column="zone"/> <result property="zone" column="zone"/>
<result property="distanceLimit" column="distance_limit"/> <result property="distanceLimit" column="distance_limit"/>
<result property="state" column="state"/> <result property="state" column="state"/>
...@@ -25,15 +25,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -25,15 +25,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectShopVo"> <sql id="selectShopVo">
select * from shop select *
from shop
</sql> </sql>
<select id="selectAllShop" resultMap="ShopResult"> <select id="selectAllShop" resultMap="ShopResult">
select id, name, code, province, city, zone from shop select id, name, code, province, city, zone
from shop
</select> </select>
<select id="selectEnableShops" resultMap="ShopResult"> <select id="selectEnableShops" resultMap="ShopResult">
select * from shop where `state` != 2 select * from shop s where `state`
<where>
<if test="states != null and states.size() > 0">
and s.state in
<foreach collection="states" item="state" separator="," open="(" close=")">#{state}</foreach>
</if>
</where>
</select>
<select id="selectDefaultSameLocationShops" resultMap="ShopResult">
select s1.* from shop s1 left join shop s2
on s1.province = s2.province and s1.city = s2.city and s1.`zone` = s2.`zone`
<where>
<if test="states != null and states.size() > 0">
and s1.state in
<foreach collection="states" item="state" separator="," open="(" close=")">#{state}</foreach>
</if>
and s2.is_default = 1
</where>
</select>
<select id="selectSameLocationShops" resultMap="ShopResult">
select s1.* from shop s1
<where>
<if test="states != null and states.size() > 0">
and s1.state in
<foreach collection="states" item="state" separator="," open="(" close=")">#{state}</foreach>
</if>
and s1.province = #{location.provinceCode}
and s1.city = #{location.cityCode}
and s1.`zone` = #{location.areaCode}
</where>
</select> </select>
<select id="selectShopList" parameterType="Shop" resultMap="ShopResult"> <select id="selectShopList" parameterType="Shop" resultMap="ShopResult">
...@@ -91,7 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -91,7 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createdAt != null">created_at,</if> <if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if> <if test="updatedAt != null">updated_at,</if>
<if test="isDefault != null">is_default,</if> <if test="isDefault != null">is_default,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if> <if test="name != null and name != ''">#{name},</if>
<if test="code != null and code != ''">#{code},</if> <if test="code != null and code != ''">#{code},</if>
...@@ -109,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -109,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createdAt != null">#{createdAt},</if> <if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if> <if test="updatedAt != null">#{updatedAt},</if>
<if test="isDefault != null">#{isDefault},</if> <if test="isDefault != null">#{isDefault},</if>
</trim> </trim>
</insert> </insert>
<update id="updateShop" parameterType="Shop"> <update id="updateShop" parameterType="Shop">
...@@ -135,16 +168,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -135,16 +168,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteShopById" parameterType="String"> <delete id="deleteShopById" parameterType="String">
delete from shop where id = #{id} delete
from shop
where id = #{id}
</delete> </delete>
<delete id="deleteShopByIds" parameterType="String"> <delete id="deleteShopByIds" parameterType="String">
delete from shop where id in delete from shop where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<update id="updateNoDefault"> <update id="updateNoDefault">
update shop set is_default = 0 update shop
set is_default = 0
</update> </update>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment