Commit 38925589 by wuwenlong

mybatis-plus 优化;

优惠券领取记录;
门店包厢管理优化;
parent 0e2c3755
package share.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType;
import share.system.domain.SConsumerCoupon;
import share.system.service.ISConsumerCouponService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
/**
* 优惠券领取记录Controller
*
* @author wuwenlong
* @date 2023-10-12
*/
@RestController
@RequestMapping("/system/coupon")
public class SConsumerCouponController extends BaseController
{
@Autowired
private ISConsumerCouponService sConsumerCouponService;
/**
* 查询优惠券领取记录列表
*/
@PreAuthorize("@ss.hasPermi('system:coupon:list')")
@GetMapping("/list")
public TableDataInfo list(SConsumerCoupon sConsumerCoupon)
{
startPage();
List<SConsumerCoupon> list = sConsumerCouponService.selectSConsumerCouponList(sConsumerCoupon);
return getDataTable(list);
}
/**
* 导出优惠券领取记录列表
*/
@PreAuthorize("@ss.hasPermi('system:coupon:export')")
@Log(title = "优惠券领取记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SConsumerCoupon sConsumerCoupon)
{
List<SConsumerCoupon> list = sConsumerCouponService.selectSConsumerCouponList(sConsumerCoupon);
ExcelUtil<SConsumerCoupon> util = new ExcelUtil<SConsumerCoupon>(SConsumerCoupon.class);
util.exportExcel(response, list, "优惠券领取记录数据");
}
/**
* 获取优惠券领取记录详细信息
*/
@PreAuthorize("@ss.hasPermi('system:coupon:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sConsumerCouponService.selectSConsumerCouponById(id));
}
/**
* 新增优惠券领取记录
*/
@PreAuthorize("@ss.hasPermi('system:coupon:add')")
@Log(title = "优惠券领取记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SConsumerCoupon sConsumerCoupon)
{
return toAjax(sConsumerCouponService.insertSConsumerCoupon(sConsumerCoupon));
}
/**
* 修改优惠券领取记录
*/
@PreAuthorize("@ss.hasPermi('system:coupon:edit')")
@Log(title = "优惠券领取记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SConsumerCoupon sConsumerCoupon)
{
return toAjax(sConsumerCouponService.updateSConsumerCoupon(sConsumerCoupon));
}
/**
* 删除优惠券领取记录
*/
@PreAuthorize("@ss.hasPermi('system:coupon:remove')")
@Log(title = "优惠券领取记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sConsumerCouponService.deleteSConsumerCouponByIds(ids));
}
}
package share.web.system.controller; package share.web.controller.system;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
......
package share.web.system.controller; package share.web.controller.system;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
......
...@@ -17,6 +17,7 @@ import share.common.core.controller.BaseController; ...@@ -17,6 +17,7 @@ import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult; import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.system.domain.SRoom; import share.system.domain.SRoom;
import share.system.domain.vo.SRoomVo;
import share.system.service.ISRoomService; import share.system.service.ISRoomService;
import share.common.utils.poi.ExcelUtil; import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo; import share.common.core.page.TableDataInfo;
...@@ -42,7 +43,7 @@ public class SRoomController extends BaseController ...@@ -42,7 +43,7 @@ public class SRoomController extends BaseController
public TableDataInfo list(SRoom sRoom) public TableDataInfo list(SRoom sRoom)
{ {
startPage(); startPage();
List<SRoom> list = sRoomService.selectSRoomList(sRoom); List<SRoomVo> list = sRoomService.selectSRoomList(sRoom);
return getDataTable(list); return getDataTable(list);
} }
...@@ -54,8 +55,8 @@ public class SRoomController extends BaseController ...@@ -54,8 +55,8 @@ public class SRoomController extends BaseController
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SRoom sRoom) public void export(HttpServletResponse response, SRoom sRoom)
{ {
List<SRoom> list = sRoomService.selectSRoomList(sRoom); List<SRoomVo> list = sRoomService.selectSRoomList(sRoom);
ExcelUtil<SRoom> util = new ExcelUtil<SRoom>(SRoom.class); ExcelUtil<SRoomVo> util = new ExcelUtil<SRoomVo>(SRoomVo.class);
util.exportExcel(response, list, "房间数据"); util.exportExcel(response, list, "房间数据");
} }
......
package share.web.system.controller; package share.web.controller.system;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
......
...@@ -125,6 +125,12 @@ ...@@ -125,6 +125,12 @@
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-annotation</artifactId>
<version>3.3.1</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
......
...@@ -4,6 +4,8 @@ import java.io.Serializable; ...@@ -4,6 +4,8 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
...@@ -19,6 +21,7 @@ public class BaseEntity implements Serializable ...@@ -19,6 +21,7 @@ public class BaseEntity implements Serializable
/** 搜索值 */ /** 搜索值 */
@JsonIgnore @JsonIgnore
@TableField(exist = false)
private String searchValue; private String searchValue;
/** 创建者 */ /** 创建者 */
...@@ -40,6 +43,7 @@ public class BaseEntity implements Serializable ...@@ -40,6 +43,7 @@ public class BaseEntity implements Serializable
/** 请求参数 */ /** 请求参数 */
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
private Map<String, Object> params; private Map<String, Object> params;
public String getSearchValue() public String getSearchValue()
......
...@@ -6,6 +6,8 @@ import java.util.Arrays; ...@@ -6,6 +6,8 @@ import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import javax.sql.DataSource; import javax.sql.DataSource;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.io.VFS; import org.apache.ibatis.io.VFS;
import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean; import org.mybatis.spring.SqlSessionFactoryBean;
...@@ -122,7 +124,8 @@ public class MyBatisConfig ...@@ -122,7 +124,8 @@ public class MyBatisConfig
typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
VFS.addImplClass(SpringBootVFS.class); VFS.addImplClass(SpringBootVFS.class);
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); // final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource); sessionFactory.setDataSource(dataSource);
sessionFactory.setTypeAliasesPackage(typeAliasesPackage); sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
......
# 代码生成 # 代码生成
gen: gen:
# 作者 # 作者
author: ruoyi author: wuwenlong
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: share.system packageName: share.system
# 自动去除表前缀,默认是false # 自动去除表前缀,默认是false
......
package ${packageName}.controller; package share.web.controller.system;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
......
...@@ -11,7 +11,9 @@ import share.common.core.domain.BaseEntity; ...@@ -11,7 +11,9 @@ import share.common.core.domain.BaseEntity;
#elseif($table.tree) #elseif($table.tree)
import share.common.core.domain.TreeEntity; import share.common.core.domain.TreeEntity;
#end #end
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
/** /**
* ${functionName}对象 ${tableName} * ${functionName}对象 ${tableName}
* *
...@@ -23,6 +25,7 @@ import share.common.core.domain.TreeEntity; ...@@ -23,6 +25,7 @@ import share.common.core.domain.TreeEntity;
#elseif($table.tree) #elseif($table.tree)
#set($Entity="TreeEntity") #set($Entity="TreeEntity")
#end #end
@Data
public class ${ClassName} extends ${Entity} public class ${ClassName} extends ${Entity}
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -42,6 +45,10 @@ public class ${ClassName} extends ${Entity} ...@@ -42,6 +45,10 @@ public class ${ClassName} extends ${Entity}
#elseif($column.javaType == 'Date') #elseif($column.javaType == 'Date')
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
#elseif($column.javaField == 'isDelete')
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField(select = false)
#else #else
@Excel(name = "${comment}") @Excel(name = "${comment}")
#end #end
...@@ -55,24 +62,24 @@ public class ${ClassName} extends ${Entity} ...@@ -55,24 +62,24 @@ public class ${ClassName} extends ${Entity}
private List<${subClassName}> ${subclassName}List; private List<${subClassName}> ${subclassName}List;
#end #end
#foreach ($column in $columns) ###foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField)) ###if(!$table.isSuperColumn($column.javaField))
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) ###if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
#set($AttrName=$column.javaField) ###set($AttrName=$column.javaField)
#else ###else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) ###set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end ###end
public void set${AttrName}($column.javaType $column.javaField) ## public void set${AttrName}($column.javaType $column.javaField)
{ ## {
this.$column.javaField = $column.javaField; ## this.$column.javaField = $column.javaField;
} ## }
##
public $column.javaType get${AttrName}() ## public $column.javaType get${AttrName}()
{ ## {
return $column.javaField; ## return $column.javaField;
} ## }
#end ###end
#end ###end
#if($table.sub) #if($table.sub)
public List<${subClassName}> get${subClassName}List() public List<${subClassName}> get${subClassName}List()
......
package ${packageName}.mapper; package ${packageName}.mapper;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import ${packageName}.domain.${ClassName}; import ${packageName}.domain.${ClassName};
#if($table.sub) #if($table.sub)
import ${packageName}.domain.${subClassName}; import ${packageName}.domain.${subClassName};
...@@ -12,7 +13,7 @@ import ${packageName}.domain.${subClassName}; ...@@ -12,7 +13,7 @@ import ${packageName}.domain.${subClassName};
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
*/ */
public interface ${ClassName}Mapper public interface ${ClassName}Mapper extends BaseMapper<${ClassName}>
{ {
/** /**
* 查询${functionName} * 查询${functionName}
......
package ${packageName}.service; package ${packageName}.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import ${packageName}.domain.${ClassName}; import ${packageName}.domain.${ClassName};
/** /**
...@@ -9,7 +10,7 @@ import ${packageName}.domain.${ClassName}; ...@@ -9,7 +10,7 @@ import ${packageName}.domain.${ClassName};
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
*/ */
public interface I${ClassName}Service public interface I${ClassName}Service extends IService<${ClassName}>
{ {
/** /**
* 查询${functionName} * 查询${functionName}
......
package ${packageName}.service.impl; package ${packageName}.service.impl;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime') #if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
...@@ -26,7 +27,7 @@ import ${packageName}.service.I${ClassName}Service; ...@@ -26,7 +27,7 @@ import ${packageName}.service.I${ClassName}Service;
* @date ${datetime} * @date ${datetime}
*/ */
@Service @Service
public class ${ClassName}ServiceImpl implements I${ClassName}Service public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service
{ {
@Autowired @Autowired
private ${ClassName}Mapper ${className}Mapper; private ${ClassName}Mapper ${className}Mapper;
......
...@@ -22,7 +22,25 @@ ...@@ -22,7 +22,25 @@
<groupId>share</groupId> <groupId>share</groupId>
<artifactId>share-common</artifactId> <artifactId>share-common</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-core</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.1</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package share.system.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
/**
* 优惠券领取记录对象 s_consumer_coupon
*
* @author wuwenlong
* @date 2023-10-12
*/
@Data
public class SConsumerCoupon extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** ID */
private Long id;
/** 用户ID */
@Excel(name = "用户ID")
private Long consumerId;
/** 优惠券ID */
@Excel(name = "优惠券ID")
private Long couponId;
/** 优惠券编码 */
@Excel(name = "优惠券编码")
private String couponCode;
/** 优惠券名称 */
@Excel(name = "优惠券名称")
private String name;
/** 优惠券类型(1:折扣券,2,满减券,3:时长券) */
@Excel(name = "优惠券类型(1:折扣券,2,满减券,3:时长券)")
private String couponType;
/** 折扣最大时长 */
@Excel(name = "折扣最大时长")
private String maxDuration;
/** 时长 */
@Excel(name = "时长")
private String duration;
/** 门槛金额 */
@Excel(name = "门槛金额")
private BigDecimal minPrice;
/** 减去金额(满减券单位:元,折扣为系数) */
@Excel(name = "减去金额(满减券单位:元,折扣为系数)")
private BigDecimal subPrice;
/** 优惠券来源(1:领取,2:赠送,3:验券) */
@Excel(name = "优惠券来源(1:领取,2:赠送,3:验券)")
private String sourceType;
/** 平台类型(1:自营,2:美团) */
@Excel(name = "平台类型(1:自营,2:美团)")
private String platformType;
/** 有效期开始 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "有效期开始", width = 30, dateFormat = "yyyy-MM-dd")
private Date startDate;
/** 有效期结束 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "有效期结束", width = 30, dateFormat = "yyyy-MM-dd")
private Date endDate;
/** 使用时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "使用时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date useDate;
/** 使用状态(0:待使用,1:已使用,2:已失效) */
@Excel(name = "使用状态(0:待使用,1:已使用,2:已失效)")
private String useStatus;
/** 删除状态(0:未删除,1:已删除) */
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField(select = false)
private Integer isDelete;
/** 更新者 */
@Excel(name = "更新者")
private String deleteBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date deleteTime;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("consumerId", getConsumerId())
.append("couponId", getCouponId())
.append("couponCode", getCouponCode())
.append("name", getName())
.append("couponType", getCouponType())
.append("maxDuration", getMaxDuration())
.append("duration", getDuration())
.append("minPrice", getMinPrice())
.append("subPrice", getSubPrice())
.append("sourceType", getSourceType())
.append("platformType", getPlatformType())
.append("startDate", getStartDate())
.append("endDate", getEndDate())
.append("useDate", getUseDate())
.append("useStatus", getUseStatus())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("deleteBy", getDeleteBy())
.append("deleteTime", getDeleteTime())
.append("remark", getRemark())
.toString();
}
}
...@@ -9,7 +9,7 @@ import share.common.core.domain.BaseEntity; ...@@ -9,7 +9,7 @@ import share.common.core.domain.BaseEntity;
* 房间对象 s_room * 房间对象 s_room
* *
* @author ruoyi * @author ruoyi
* @date 2023-09-27 * @date 2023-10-12
*/ */
public class SRoom extends BaseEntity public class SRoom extends BaseEntity
{ {
...@@ -22,10 +22,6 @@ public class SRoom extends BaseEntity ...@@ -22,10 +22,6 @@ public class SRoom extends BaseEntity
@Excel(name = "门店ID") @Excel(name = "门店ID")
private Long storeId; private Long storeId;
/** 所属门店 */
@Excel(name = "所属门店")
private String storeName;
/** 房间名称 */ /** 房间名称 */
@Excel(name = "房间名称") @Excel(name = "房间名称")
private String name; private String name;
...@@ -92,15 +88,6 @@ public class SRoom extends BaseEntity ...@@ -92,15 +88,6 @@ public class SRoom extends BaseEntity
{ {
return storeId; return storeId;
} }
public void setStoreName(String storeName)
{
this.storeName = storeName;
}
public String getStoreName()
{
return storeName;
}
public void setName(String name) public void setName(String name)
{ {
this.name = name; this.name = name;
...@@ -215,7 +202,6 @@ public class SRoom extends BaseEntity ...@@ -215,7 +202,6 @@ public class SRoom extends BaseEntity
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("storeId", getStoreId()) .append("storeId", getStoreId())
.append("storeName", getStoreName())
.append("name", getName()) .append("name", getName())
.append("roomType", getRoomType()) .append("roomType", getRoomType())
.append("images", getImages()) .append("images", getImages())
......
package share.system.domain; package share.system.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel; import share.common.annotation.Excel;
......
package share.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
/**
* 房间对象 s_room
*
* @author ruoyi
* @date 2023-10-12
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@Data
public class SRoomVo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 房间ID */
private Long id;
/** 门店ID */
@Excel(name = "门店ID")
private Long storeId;
/** 门店名称 */
@Excel(name = "门店名称")
private String storeName;
/** 房间名称 */
@Excel(name = "房间名称")
private String name;
/** 房间类型(中、大、豪华包) */
@Excel(name = "房间类型(中、大、豪华包)")
private String roomType;
/** 房间主图 */
@Excel(name = "房间主图")
private String images;
/** 房间设施(空调、外窗、沙发、茶几、、、) */
@Excel(name = "房间设施(空调、外窗、沙发、茶几、、、)")
private String facilities;
/** 房间详情介绍 */
@Excel(name = "房间详情介绍")
private String info;
/** 房间状态(空闲、保洁中、使用中、维护中) */
@Excel(name = "房间状态(空闲、保洁中、使用中、维护中)")
private String status;
/** 房间单价(默认单位:元/小时) */
@Excel(name = "房间单价(默认单位:元/小时)")
private Integer price;
/** 门锁编码(接入第三方使用) */
@Excel(name = "门锁编码(接入第三方使用)")
private String doorLockCode;
/** 电控控制(接入第三方使用) */
@Excel(name = "电控控制(接入第三方使用)")
private String electricControlCode;
/** 门禁密码(多人可设置多个) */
@Excel(name = "门禁密码(多人可设置多个)")
private String password;
/** 其他可能硬件接入参数(备用1) */
@Excel(name = "其他可能硬件接入参数(备用1)")
private String params1;
/** 其他可能硬件接入参数(备用2) */
@Excel(name = "其他可能硬件接入参数(备用2)")
private String params2;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("storeId", getStoreId())
.append("storeName", getStoreName())
.append("name", getName())
.append("roomType", getRoomType())
.append("images", getImages())
.append("facilities", getFacilities())
.append("info", getInfo())
.append("status", getStatus())
.append("price", getPrice())
.append("doorLockCode", getDoorLockCode())
.append("electricControlCode", getElectricControlCode())
.append("password", getPassword())
.append("params1", getParams1())
.append("params2", getParams2())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package share.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.SConsumerCoupon;
/**
* 优惠券领取记录Mapper接口
*
* @author wuwenlong
* @date 2023-10-12
*/
public interface SConsumerCouponMapper extends BaseMapper<SConsumerCoupon>
{
/**
* 查询优惠券领取记录
*
* @param id 优惠券领取记录主键
* @return 优惠券领取记录
*/
public SConsumerCoupon selectSConsumerCouponById(Long id);
/**
* 查询优惠券领取记录列表
*
* @param sConsumerCoupon 优惠券领取记录
* @return 优惠券领取记录集合
*/
public List<SConsumerCoupon> selectSConsumerCouponList(SConsumerCoupon sConsumerCoupon);
/**
* 新增优惠券领取记录
*
* @param sConsumerCoupon 优惠券领取记录
* @return 结果
*/
public int insertSConsumerCoupon(SConsumerCoupon sConsumerCoupon);
/**
* 修改优惠券领取记录
*
* @param sConsumerCoupon 优惠券领取记录
* @return 结果
*/
public int updateSConsumerCoupon(SConsumerCoupon sConsumerCoupon);
/**
* 删除优惠券领取记录
*
* @param id 优惠券领取记录主键
* @return 结果
*/
public int deleteSConsumerCouponById(Long id);
/**
* 批量删除优惠券领取记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSConsumerCouponByIds(Long[] ids);
}
package share.system.mapper; package share.system.mapper;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.SStore; import share.system.domain.SStore;
/** /**
...@@ -9,7 +11,7 @@ import share.system.domain.SStore; ...@@ -9,7 +11,7 @@ import share.system.domain.SStore;
* @author ruoyi * @author ruoyi
* @date 2023-10-11 * @date 2023-10-11
*/ */
public interface SStoreMapper public interface SStoreMapper extends BaseMapper<SStore>
{ {
/** /**
* 查询门店 * 查询门店
......
package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.SConsumerCoupon;
/**
* 优惠券领取记录Service接口
*
* @author wuwenlong
* @date 2023-10-12
*/
public interface ISConsumerCouponService extends IService<SConsumerCoupon>
{
/**
* 查询优惠券领取记录
*
* @param id 优惠券领取记录主键
* @return 优惠券领取记录
*/
public SConsumerCoupon selectSConsumerCouponById(Long id);
/**
* 查询优惠券领取记录列表
*
* @param sConsumerCoupon 优惠券领取记录
* @return 优惠券领取记录集合
*/
public List<SConsumerCoupon> selectSConsumerCouponList(SConsumerCoupon sConsumerCoupon);
/**
* 新增优惠券领取记录
*
* @param sConsumerCoupon 优惠券领取记录
* @return 结果
*/
public int insertSConsumerCoupon(SConsumerCoupon sConsumerCoupon);
/**
* 修改优惠券领取记录
*
* @param sConsumerCoupon 优惠券领取记录
* @return 结果
*/
public int updateSConsumerCoupon(SConsumerCoupon sConsumerCoupon);
/**
* 批量删除优惠券领取记录
*
* @param ids 需要删除的优惠券领取记录主键集合
* @return 结果
*/
public int deleteSConsumerCouponByIds(Long[] ids);
/**
* 删除优惠券领取记录信息
*
* @param id 优惠券领取记录主键
* @return 结果
*/
public int deleteSConsumerCouponById(Long id);
}
...@@ -2,6 +2,7 @@ package share.system.service; ...@@ -2,6 +2,7 @@ package share.system.service;
import java.util.List; import java.util.List;
import share.system.domain.SRoom; import share.system.domain.SRoom;
import share.system.domain.vo.SRoomVo;
/** /**
* 房间Service接口 * 房间Service接口
...@@ -17,7 +18,7 @@ public interface ISRoomService ...@@ -17,7 +18,7 @@ public interface ISRoomService
* @param id 房间主键 * @param id 房间主键
* @return 房间 * @return 房间
*/ */
public SRoom selectSRoomById(Long id); public SRoomVo selectSRoomById(Long id);
/** /**
* 查询房间列表 * 查询房间列表
...@@ -25,7 +26,7 @@ public interface ISRoomService ...@@ -25,7 +26,7 @@ public interface ISRoomService
* @param sRoom 房间 * @param sRoom 房间
* @return 房间集合 * @return 房间集合
*/ */
public List<SRoom> selectSRoomList(SRoom sRoom); public List<SRoomVo> selectSRoomList(SRoom sRoom);
/** /**
* 新增房间 * 新增房间
......
...@@ -3,6 +3,7 @@ package share.system.service; ...@@ -3,6 +3,7 @@ package share.system.service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.SStore; import share.system.domain.SStore;
/** /**
...@@ -11,7 +12,7 @@ import share.system.domain.SStore; ...@@ -11,7 +12,7 @@ import share.system.domain.SStore;
* @author ruoyi * @author ruoyi
* @date 2023-10-11 * @date 2023-10-11
*/ */
public interface ISStoreService public interface ISStoreService extends IService<SStore>
{ {
/** /**
* 查询门店 * 查询门店
...@@ -68,4 +69,12 @@ public interface ISStoreService ...@@ -68,4 +69,12 @@ public interface ISStoreService
* @return 门店集合 * @return 门店集合
*/ */
public List<Map> optionList(SStore sStore); public List<Map> optionList(SStore sStore);
/**
* 通过ids查询门店下拉列表
*
* @param ids 门店
* @return 门店集合
*/
public List<Map> optionList(List<Long> ids);
} }
package share.system.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.mapper.SConsumerCouponMapper;
import share.system.domain.SConsumerCoupon;
import share.system.service.ISConsumerCouponService;
/**
* 优惠券领取记录Service业务层处理
*
* @author wuwenlong
* @date 2023-10-12
*/
@Service
public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMapper, SConsumerCoupon> implements ISConsumerCouponService
{
@Autowired
private SConsumerCouponMapper sConsumerCouponMapper;
/**
* 查询优惠券领取记录
*
* @param id 优惠券领取记录主键
* @return 优惠券领取记录
*/
@Override
public SConsumerCoupon selectSConsumerCouponById(Long id)
{
return sConsumerCouponMapper.selectSConsumerCouponById(id);
}
/**
* 查询优惠券领取记录列表
*
* @param sConsumerCoupon 优惠券领取记录
* @return 优惠券领取记录
*/
@Override
public List<SConsumerCoupon> selectSConsumerCouponList(SConsumerCoupon sConsumerCoupon)
{
return sConsumerCouponMapper.selectSConsumerCouponList(sConsumerCoupon);
}
/**
* 新增优惠券领取记录
*
* @param sConsumerCoupon 优惠券领取记录
* @return 结果
*/
@Override
public int insertSConsumerCoupon(SConsumerCoupon sConsumerCoupon)
{
sConsumerCoupon.setCreateTime(DateUtils.getNowDate());
return sConsumerCouponMapper.insertSConsumerCoupon(sConsumerCoupon);
}
/**
* 修改优惠券领取记录
*
* @param sConsumerCoupon 优惠券领取记录
* @return 结果
*/
@Override
public int updateSConsumerCoupon(SConsumerCoupon sConsumerCoupon)
{
sConsumerCoupon.setUpdateTime(DateUtils.getNowDate());
return sConsumerCouponMapper.updateSConsumerCoupon(sConsumerCoupon);
}
/**
* 批量删除优惠券领取记录
*
* @param ids 需要删除的优惠券领取记录主键
* @return 结果
*/
@Override
public int deleteSConsumerCouponByIds(Long[] ids)
{
return sConsumerCouponMapper.deleteSConsumerCouponByIds(ids);
}
/**
* 删除优惠券领取记录信息
*
* @param id 优惠券领取记录主键
* @return 结果
*/
@Override
public int deleteSConsumerCouponById(Long id)
{
return sConsumerCouponMapper.deleteSConsumerCouponById(id);
}
}
package share.system.service.impl; package share.system.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import share.system.domain.SStore;
import share.system.domain.vo.SRoomVo;
import share.system.mapper.SRoomMapper; import share.system.mapper.SRoomMapper;
import share.system.domain.SRoom; import share.system.domain.SRoom;
import share.system.service.ISRoomService; import share.system.service.ISRoomService;
import share.system.service.ISStoreService;
/** /**
* 房间Service业务层处理 * 房间Service业务层处理
...@@ -20,6 +30,9 @@ public class SRoomServiceImpl implements ISRoomService ...@@ -20,6 +30,9 @@ public class SRoomServiceImpl implements ISRoomService
@Autowired @Autowired
private SRoomMapper sRoomMapper; private SRoomMapper sRoomMapper;
@Autowired
private ISStoreService sStoreService;
/** /**
* 查询房间 * 查询房间
* *
...@@ -27,9 +40,13 @@ public class SRoomServiceImpl implements ISRoomService ...@@ -27,9 +40,13 @@ public class SRoomServiceImpl implements ISRoomService
* @return 房间 * @return 房间
*/ */
@Override @Override
public SRoom selectSRoomById(Long id) public SRoomVo selectSRoomById(Long id)
{ {
return sRoomMapper.selectSRoomById(id); SRoom sRoom = sRoomMapper.selectSRoomById(id);
if(Objects.nonNull(sRoom)&&sRoom.getId()!=null){
return convertVoList(new ArrayList<SRoom>(){{add(sRoom);}}).get(0);
}
return new SRoomVo();
} }
/** /**
...@@ -39,9 +56,29 @@ public class SRoomServiceImpl implements ISRoomService ...@@ -39,9 +56,29 @@ public class SRoomServiceImpl implements ISRoomService
* @return 房间 * @return 房间
*/ */
@Override @Override
public List<SRoom> selectSRoomList(SRoom sRoom) public List<SRoomVo> selectSRoomList(SRoom sRoom)
{ {
return sRoomMapper.selectSRoomList(sRoom); List<SRoom> roomList = sRoomMapper.selectSRoomList(sRoom);
return convertVoList(roomList);
}
private List<SRoomVo> convertVoList(List<SRoom> roomList){
List<SRoomVo> voList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(roomList)) {
List<Long> storeIds = roomList.stream().map(SRoom::getStoreId).collect(Collectors.toList());
List<Map> storeList = sStoreService.optionList(storeIds);
roomList.stream().forEach(sRoom -> {
SRoomVo vo = new SRoomVo();
BeanUtils.copyProperties(sRoom, vo);
storeList.stream().forEach(store -> {
if(vo.getStoreId().compareTo(Long.parseLong(store.get("id").toString())) == 0){
vo.setStoreName(store.getOrDefault("name","").toString());
}
});
voList.add(vo);
});
}
return voList;
} }
/** /**
......
...@@ -6,6 +6,7 @@ import java.util.List; ...@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -21,7 +22,7 @@ import share.system.service.ISStoreService; ...@@ -21,7 +22,7 @@ import share.system.service.ISStoreService;
* @date 2023-10-11 * @date 2023-10-11
*/ */
@Service @Service
public class SStoreServiceImpl implements ISStoreService public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> implements ISStoreService
{ {
@Autowired @Autowired
private SStoreMapper sStoreMapper; private SStoreMapper sStoreMapper;
...@@ -103,15 +104,28 @@ public class SStoreServiceImpl implements ISStoreService ...@@ -103,15 +104,28 @@ public class SStoreServiceImpl implements ISStoreService
@Override @Override
public List<Map> optionList(SStore sStore) { public List<Map> optionList(SStore sStore) {
List<SStore> storeList = sStoreMapper.selectSStoreList(sStore); List<SStore> storeList = sStoreMapper.selectSStoreList(sStore);
return convertOptionList(storeList);
}
@Override
public List<Map> optionList(List<Long> ids) {
List<SStore> storeList = sStoreMapper.selectBatchIds(ids);
return convertOptionList(storeList);
}
private List<Map> convertOptionList(List<SStore> storeList){
List<Map> result = new ArrayList<>(); List<Map> result = new ArrayList<>();
if(CollectionUtils.isNotEmpty(storeList)) { if(CollectionUtils.isNotEmpty(storeList)) {
result = storeList.stream().map(store -> { result = storeList.stream().map(store -> {
Map<Long, String> map = new HashMap<Long, String>() {{ Map<String, Object> map = new HashMap<String, Object>() {{
put(store.getId(), store.getName()); put("id", store.getId());
put("name", store.getName());
put("storeType", store.getStoreType());
}}; }};
return map; return map;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
return result; return result;
} }
} }
<?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="share.system.mapper.SConsumerCouponMapper">
<resultMap type="SConsumerCoupon" id="SConsumerCouponResult">
<result property="id" column="id" />
<result property="consumerId" column="consumer_id" />
<result property="couponId" column="coupon_id" />
<result property="couponCode" column="coupon_code" />
<result property="name" column="name" />
<result property="couponType" column="coupon_type" />
<result property="maxDuration" column="max_duration" />
<result property="duration" column="duration" />
<result property="minPrice" column="min_price" />
<result property="subPrice" column="sub_price" />
<result property="sourceType" column="source_type" />
<result property="platformType" column="platform_type" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
<result property="useDate" column="use_date" />
<result property="useStatus" column="use_status" />
<result property="isDelete" column="is_delete" />
<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="deleteBy" column="delete_by" />
<result property="deleteTime" column="delete_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSConsumerCouponVo">
select id, consumer_id, coupon_id, coupon_code, name, coupon_type, max_duration, duration, min_price, sub_price, source_type, platform_type, start_date, end_date, use_date, use_status, is_delete, create_by, create_time, update_by, update_time, delete_by, delete_time, remark from s_consumer_coupon
</sql>
<select id="selectSConsumerCouponList" parameterType="SConsumerCoupon" resultMap="SConsumerCouponResult">
<include refid="selectSConsumerCouponVo"/>
<where>
<if test="consumerId != null "> and consumer_id = #{consumerId}</if>
<if test="couponId != null "> and coupon_id = #{couponId}</if>
<if test="couponCode != null and couponCode != ''"> and coupon_code = #{couponCode}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="couponType != null and couponType != ''"> and coupon_type = #{couponType}</if>
<if test="maxDuration != null and maxDuration != ''"> and max_duration = #{maxDuration}</if>
<if test="duration != null and duration != ''"> and duration = #{duration}</if>
<if test="minPrice != null "> and min_price = #{minPrice}</if>
<if test="subPrice != null "> and sub_price = #{subPrice}</if>
<if test="sourceType != null and sourceType != ''"> and source_type = #{sourceType}</if>
<if test="platformType != null and platformType != ''"> and platform_type = #{platformType}</if>
<if test="startDate != null "> and start_date = #{startDate}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="useDate != null "> and use_date = #{useDate}</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="deleteBy != null and deleteBy != ''"> and delete_by = #{deleteBy}</if>
<if test="deleteTime != null "> and delete_time = #{deleteTime}</if>
</where>
</select>
<select id="selectSConsumerCouponById" parameterType="Long" resultMap="SConsumerCouponResult">
<include refid="selectSConsumerCouponVo"/>
where id = #{id}
</select>
<insert id="insertSConsumerCoupon" parameterType="SConsumerCoupon" useGeneratedKeys="true" keyProperty="id">
insert into s_consumer_coupon
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="consumerId != null">consumer_id,</if>
<if test="couponId != null">coupon_id,</if>
<if test="couponCode != null and couponCode != ''">coupon_code,</if>
<if test="name != null and name != ''">name,</if>
<if test="couponType != null">coupon_type,</if>
<if test="maxDuration != null">max_duration,</if>
<if test="duration != null and duration != ''">duration,</if>
<if test="minPrice != null">min_price,</if>
<if test="subPrice != null">sub_price,</if>
<if test="sourceType != null">source_type,</if>
<if test="platformType != null">platform_type,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if>
<if test="useDate != null">use_date,</if>
<if test="useStatus != null">use_status,</if>
<if test="isDelete != null">is_delete,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleteBy != null">delete_by,</if>
<if test="deleteTime != null">delete_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="consumerId != null">#{consumerId},</if>
<if test="couponId != null">#{couponId},</if>
<if test="couponCode != null and couponCode != ''">#{couponCode},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="couponType != null">#{couponType},</if>
<if test="maxDuration != null">#{maxDuration},</if>
<if test="duration != null and duration != ''">#{duration},</if>
<if test="minPrice != null">#{minPrice},</if>
<if test="subPrice != null">#{subPrice},</if>
<if test="sourceType != null">#{sourceType},</if>
<if test="platformType != null">#{platformType},</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if>
<if test="useDate != null">#{useDate},</if>
<if test="useStatus != null">#{useStatus},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleteBy != null">#{deleteBy},</if>
<if test="deleteTime != null">#{deleteTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSConsumerCoupon" parameterType="SConsumerCoupon">
update s_consumer_coupon
<trim prefix="SET" suffixOverrides=",">
<if test="consumerId != null">consumer_id = #{consumerId},</if>
<if test="couponId != null">coupon_id = #{couponId},</if>
<if test="couponCode != null and couponCode != ''">coupon_code = #{couponCode},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="couponType != null">coupon_type = #{couponType},</if>
<if test="maxDuration != null">max_duration = #{maxDuration},</if>
<if test="duration != null and duration != ''">duration = #{duration},</if>
<if test="minPrice != null">min_price = #{minPrice},</if>
<if test="subPrice != null">sub_price = #{subPrice},</if>
<if test="sourceType != null">source_type = #{sourceType},</if>
<if test="platformType != null">platform_type = #{platformType},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="useDate != null">use_date = #{useDate},</if>
<if test="useStatus != null">use_status = #{useStatus},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleteBy != null">delete_by = #{deleteBy},</if>
<if test="deleteTime != null">delete_time = #{deleteTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSConsumerCouponById" parameterType="Long">
delete from s_consumer_coupon where id = #{id}
</delete>
<delete id="deleteSConsumerCouponByIds" parameterType="String">
delete from s_consumer_coupon where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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="share.system.mapper.SRoomMapper"> <mapper namespace="share.system.mapper.SRoomMapper">
<resultMap type="SRoom" id="SRoomResult"> <resultMap type="SRoom" id="SRoomResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="storeId" column="store_id" /> <result property="storeId" column="store_id" />
<result property="storeName" column="store_name" />
<result property="name" column="name" /> <result property="name" column="name" />
<result property="roomType" column="room_type" /> <result property="roomType" column="room_type" />
<result property="images" column="images" /> <result property="images" column="images" />
...@@ -28,14 +27,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -28,14 +27,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectSRoomVo"> <sql id="selectSRoomVo">
select id, store_id, store_name, name, room_type, images, facilities, info, status, price, door_lock_code, electric_control_code, password, params1, params2, create_by, create_time, update_by, update_time, remark from s_room select id, store_id, name, room_type, images, facilities, info, status, price, door_lock_code, electric_control_code, password, params1, params2, create_by, create_time, update_by, update_time, remark from s_room
</sql> </sql>
<select id="selectSRoomList" parameterType="SRoom" resultMap="SRoomResult"> <select id="selectSRoomList" parameterType="SRoom" resultMap="SRoomResult">
<include refid="selectSRoomVo"/> <include refid="selectSRoomVo"/>
<where> <where>
<if test="storeId != null "> and store_id = #{storeId}</if> <if test="storeId != null "> and store_id = #{storeId}</if>
<if test="storeName != null and storeName != ''"> and store_name like concat('%', #{storeName}, '%')</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="roomType != null and roomType != ''"> and room_type = #{roomType}</if> <if test="roomType != null and roomType != ''"> and room_type = #{roomType}</if>
<if test="images != null and images != ''"> and images = #{images}</if> <if test="images != null and images != ''"> and images = #{images}</if>
...@@ -60,7 +58,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -60,7 +58,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into s_room insert into s_room
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="storeId != null">store_id,</if> <if test="storeId != null">store_id,</if>
<if test="storeName != null">store_name,</if>
<if test="name != null">name,</if> <if test="name != null">name,</if>
<if test="roomType != null">room_type,</if> <if test="roomType != null">room_type,</if>
<if test="images != null">images,</if> <if test="images != null">images,</if>
...@@ -81,7 +78,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -81,7 +78,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storeId != null">#{storeId},</if> <if test="storeId != null">#{storeId},</if>
<if test="storeName != null">#{storeName},</if>
<if test="name != null">#{name},</if> <if test="name != null">#{name},</if>
<if test="roomType != null">#{roomType},</if> <if test="roomType != null">#{roomType},</if>
<if test="images != null">#{images},</if> <if test="images != null">#{images},</if>
...@@ -106,7 +102,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -106,7 +102,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update s_room update s_room
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="storeId != null">store_id = #{storeId},</if> <if test="storeId != null">store_id = #{storeId},</if>
<if test="storeName != null">store_name = #{storeName},</if>
<if test="name != null">name = #{name},</if> <if test="name != null">name = #{name},</if>
<if test="roomType != null">room_type = #{roomType},</if> <if test="roomType != null">room_type = #{roomType},</if>
<if test="images != null">images = #{images},</if> <if test="images != null">images = #{images},</if>
......
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