Commit b0e12a02 by YG8999

保洁及保洁记录

parent 8ec830ad
......@@ -61,6 +61,12 @@
<artifactId>share-generator</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.16</version>
</dependency>
</dependencies>
<build>
......
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.SConsumer;
import share.system.service.SConsumerService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 保洁员管理Controller
*
* @author lwj
* @date 2023-09-27
*/
@RestController
@RequestMapping("/system/cleanConsumer")
public class SCleanConsumerController extends BaseController
{
@Autowired
private SConsumerService sConsumerService;
/**
* 查询保洁员用户列表
*/
@PreAuthorize("@ss.hasPermi('system:cleanConsumer:list')")
@GetMapping("/list")
public TableDataInfo list(SConsumer sConsumer)
{
sConsumer.setRoleType("1");
startPage();
List<SConsumer> list = sConsumerService.selectSConsumerList(sConsumer);
return getDataTable(list);
}
/**
* 导出保洁员用户列表
*/
@PreAuthorize("@ss.hasPermi('system:cleanConsumer:export')")
@Log(title = "保洁员", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SConsumer sConsumer)
{
sConsumer.setRoleType("1");
List<SConsumer> list = sConsumerService.selectSConsumerList(sConsumer);
ExcelUtil<SConsumer> util = new ExcelUtil<SConsumer>(SConsumer.class);
util.exportExcel(response, list, "保洁用户数据");
}
/**
* 获取保洁员用户详细信息
*/
@PreAuthorize("@ss.hasPermi('system:cleanConsumer:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sConsumerService.selectSConsumerById(id));
}
/**
* 新增保洁员用户
*/
@PreAuthorize("@ss.hasPermi('system:cleanConsumer:add')")
@Log(title = "保洁员", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SConsumer sConsumer)
{
sConsumer.setRoleType("1");
sConsumer.setOpenId("0");
return toAjax(sConsumerService.insertSConsumer(sConsumer));
}
/**
* 修改保洁员
*/
@PreAuthorize("@ss.hasPermi('system:cleanConsumer:edit')")
@Log(title = "保洁员", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SConsumer sConsumer)
{
return toAjax(sConsumerService.updateSConsumer(sConsumer));
}
/**
* 删除保洁员
*/
@PreAuthorize("@ss.hasPermi('system:cleanConsumer:remove')")
@Log(title = "保洁员", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sConsumerService.deleteSConsumerByIds(ids));
}
}
......@@ -18,11 +18,16 @@ 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.core.domain.entity.SysUser;
import share.common.enums.BusinessType;
import share.system.domain.SConsumer;
import share.system.domain.SStore;
import share.system.domain.SStoreConsumer;
import share.system.domain.SysUserRole;
import share.system.service.ISStoreService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
import share.system.service.SConsumerService;
/**
* 门店Controller
......@@ -36,6 +41,8 @@ public class SStoreController extends BaseController
{
@Autowired
private ISStoreService sStoreService;
@Autowired
private SConsumerService sConsumerService;
/**
* 查询门店列表
......@@ -115,4 +122,63 @@ public class SStoreController extends BaseController
{
return success(sStoreService.optionList(sStore));
}
/**
* 查询已分配保洁列表
*/
@PreAuthorize("@ss.hasPermi('system:store:list')")
@GetMapping("/consumer/allocatedList")
public TableDataInfo allocatedList(SConsumer sConsumer)
{
startPage();
List<SConsumer> list = sConsumerService.selectAllocatedList(sConsumer);
return getDataTable(list);
}
/**
* 查询未分配保洁列表
*/
@PreAuthorize("@ss.hasPermi('system:store:list')")
@GetMapping("/consumer/unallocatedList")
public TableDataInfo unallocatedList(SConsumer sConsumer)
{
startPage();
List<SConsumer> list = sConsumerService.selectUnallocatedList(sConsumer);
return getDataTable(list);
}
/**
* 取消分配保洁
*/
@PreAuthorize("@ss.hasPermi('system:store:edit')")
@Log(title = "门店", businessType = BusinessType.GRANT)
@PutMapping("/consumer/cancel")
public AjaxResult cancelAuthUser(@RequestBody SStoreConsumer storeConsumer)
{
return toAjax(sStoreService.deleteStoreConsumer(storeConsumer));
}
/**
* 批量取消分配保洁
*/
@PreAuthorize("@ss.hasPermi('system:store:edit')")
@Log(title = "门店", businessType = BusinessType.GRANT)
@PutMapping("/consumer/cancelAll")
public AjaxResult cancelAuthUserAll(Long storeId, Long[] consumerIds)
{
return toAjax(sStoreService.deleteStoreConsumers(storeId, consumerIds));
}
/**
* 批量选择分配保洁
*/
@PreAuthorize("@ss.hasPermi('system:store:edit')")
@Log(title = "门店", businessType = BusinessType.GRANT)
@PutMapping("/consumer/selectAll")
public AjaxResult selectAuthUserAll(Long storeId, Long[] consumerIds)
{
return toAjax(sStoreService.insertStoreConsumers(storeId, consumerIds));
}
}
......@@ -47,6 +47,12 @@
<groupId>share</groupId>
<artifactId>share-framework</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.16</version>
</dependency>
</dependencies>
<build>
......
......@@ -2,6 +2,8 @@ package share.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.date.DateUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -28,7 +30,7 @@ import share.common.core.page.TableDataInfo;
* @date 2023-09-28
*/
@RestController
@RequestMapping("/system/cleanRecords")
@RequestMapping("/app/cleanRecords")
public class SCleanRecordsController extends BaseController
{
@Autowired
......@@ -37,7 +39,6 @@ public class SCleanRecordsController extends BaseController
/**
* 查询保洁记录列表
*/
@PreAuthorize("@ss.hasPermi('system:records:list')")
@GetMapping("/list")
public TableDataInfo list(SCleanRecords sCleanRecords)
{
......@@ -47,58 +48,59 @@ public class SCleanRecordsController extends BaseController
}
/**
* 导出保洁记录列表
* 根据保洁员id查询未开始的保洁记录列表
*/
@PreAuthorize("@ss.hasPermi('system:records:export')")
@Log(title = "保洁记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SCleanRecords sCleanRecords)
@GetMapping("/unCleanList")
public TableDataInfo unCleanList(SCleanRecords sCleanRecords)
{
List<SCleanRecords> list = sCleanRecordsService.selectSCleanRecordsList(sCleanRecords);
ExcelUtil<SCleanRecords> util = new ExcelUtil<SCleanRecords>(SCleanRecords.class);
util.exportExcel(response, list, "保洁记录数据");
startPage();
List<SCleanRecords> list = sCleanRecordsService.unCleanList(sCleanRecords);
return getDataTable(list);
}
/**
* 获取保洁记录详细信息
* 根据保洁员id查询已开始的保洁记录列表
*/
@PreAuthorize("@ss.hasPermi('system:records:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
@GetMapping("/myCleanList")
public TableDataInfo myCleanList(SCleanRecords sCleanRecords)
{
return success(sCleanRecordsService.selectSCleanRecordsById(id));
startPage();
List<SCleanRecords> list = sCleanRecordsService.myCleanList(sCleanRecords);
return getDataTable(list);
}
/**
* 新增保洁记录
* 获取保洁记录详细信息
*/
@PreAuthorize("@ss.hasPermi('system:records:add')")
@Log(title = "保洁记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SCleanRecords sCleanRecords)
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return toAjax(sCleanRecordsService.insertSCleanRecords(sCleanRecords));
return success(sCleanRecordsService.selectSCleanRecordsById(id));
}
/**
* 修改保洁记录
* 开始保洁
*/
@PreAuthorize("@ss.hasPermi('system:records:edit')")
@Log(title = "保洁记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SCleanRecords sCleanRecords)
@Log(title = "开始保洁", businessType = BusinessType.UPDATE)
@PostMapping(value = "startClean")
public AjaxResult startClean(@RequestBody SCleanRecords sCleanRecords)
{
sCleanRecords.setStartDate(DateUtil.date());
sCleanRecords.setStatus(1);
return toAjax(sCleanRecordsService.updateSCleanRecords(sCleanRecords));
}
/**
* 删除保洁记录
* 结束保洁
*/
@PreAuthorize("@ss.hasPermi('system:records:remove')")
@Log(title = "保洁记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
@Log(title = "开始保洁", businessType = BusinessType.UPDATE)
@PostMapping(value = "endClean")
public AjaxResult endClean(@RequestBody SCleanRecords sCleanRecords)
{
return toAjax(sCleanRecordsService.deleteSCleanRecordsByIds(ids));
sCleanRecords.setEndDate(DateUtil.date());
sCleanRecords.setStatus(2);
return toAjax(sCleanRecordsService.updateSCleanRecords(sCleanRecords));
}
}
......@@ -20,6 +20,9 @@ public class SCleanRecords extends BaseEntity
/** ID */
private Long id;
/** 门店ID */
private Long storeId;
/** 房间ID */
private Long roomId;
......@@ -44,10 +47,28 @@ public class SCleanRecords extends BaseEntity
@Excel(name = "保洁后照片")
private String endImage;
/** 保洁状态 */
/** 保洁状态:0:未保洁,1:保洁中,2:已保洁 */
@Excel(name = "保洁状态")
private Integer status;
/**
* 门店名称
*/
private String storeName;
/**
* 房间名称
*/
private String roomName;
/**
* 保洁员姓名
*/
private String cleanName;
/**
* 保洁员手机号
*/
private String phone;
public void setId(Long id)
{
this.id = id;
......@@ -121,10 +142,51 @@ public class SCleanRecords extends BaseEntity
return status;
}
public Long getStoreId() {
return storeId;
}
public void setStoreId(Long storeId) {
this.storeId = storeId;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getRoomName() {
return roomName;
}
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String getCleanName() {
return cleanName;
}
public void setCleanName(String cleanName) {
this.cleanName = cleanName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("storeId", getStoreId())
.append("roomId", getRoomId())
.append("consumerId", getConsumerId())
.append("startDate", getStartDate())
......
......@@ -46,11 +46,11 @@ public class SConsumer
/** 会员角色类型(0:会员,1:保洁人员,2:后台管理人员) */
@ApiModelProperty(value = "会员角色类型", example = "0=:会员,1:保洁人员,2:后台管理人员")
private Integer roleType;
private String roleType;
/** 会员性别(0:未知,1:男,2:女) */
@ApiModelProperty(value = "会员性别", example = "0=:未知,1:男,2:女")
private Integer sex;
private String sex;
@ApiModelProperty(value = "详细地址")
private String addres;
......@@ -84,4 +84,7 @@ public class SConsumer
@ApiModelProperty(value = "最后一次登录时间")
private Date lastLoginTime;
/** 门店ID */
private Long storeId;
}
package share.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* @className: share.system.domain.SStoreConsumer
* @description: 门店与保洁员关系
* @author: lwj
* @create: 2023-10-16 17:02
*/
public class SStoreConsumer {
/** 门店ID */
private Long storeId;
/** 保洁员ID */
private Long consumerId;
public Long getStoreId() {
return storeId;
}
public void setStoreId(Long storeId) {
this.storeId = storeId;
}
public Long getConsumerId() {
return consumerId;
}
public void setConsumerId(Long consumerId) {
this.consumerId = consumerId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("storeId", getStoreId())
.append("consumerId", getConsumerId())
.toString();
}
}
......@@ -58,4 +58,8 @@ public interface SCleanRecordsMapper
* @return 结果
*/
public int deleteSCleanRecordsByIds(Long[] ids);
List<SCleanRecords> unCleanList(SCleanRecords sCleanRecords);
List<SCleanRecords> myCleanList(SCleanRecords sCleanRecords);
}
......@@ -60,4 +60,10 @@ public interface SConsumerMapper extends BaseMapper<SConsumer>
* @return 结果
*/
public int deleteSConsumerByIds(Long[] ids);
List<SConsumer> selectAllocatedList(SConsumer sConsumer);
List<SConsumer> selectUnallocatedList(SConsumer sConsumer);
List<SConsumer> selectListByStoreId(Long storeId);
}
package share.system.mapper;
import org.apache.ibatis.annotations.Param;
import share.system.domain.SStoreConsumer;
import share.system.domain.SysUserRole;
import java.util.List;
/**
* @className: share.system.mapper.SStoreConsumerMapper
* @description: 门店与保洁员关系
* @author: lwj
* @create: 2023-10-16 17:07
*/
public interface SStoreConsumerMapper {
public int deleteByConsumerId(Long consumerId);
public int deleteSStoreConsumer(Long[] ids);
public int countByStoreId(Long storeId);
public int batchSStoreConsumer(List<SStoreConsumer> storeConsumerList);
public int deleteInfo(SStoreConsumer storeConsumer);
public int deleteInfos(@Param("storeId") Long storeId, @Param("consumerIds") Long[] consumerIds);
}
......@@ -58,4 +58,16 @@ public interface ISCleanRecordsService
* @return 结果
*/
public int deleteSCleanRecordsById(Long id);
/**
* 房间订单结束后自动调用此接口生成保洁任务
* @param storeId 门店id
* @param roomId 房间id
* @return
*/
boolean addSCleanRecords(Long storeId, Long roomId);
List<SCleanRecords> unCleanList(SCleanRecords sCleanRecords);
List<SCleanRecords> myCleanList(SCleanRecords sCleanRecords);
}
......@@ -5,6 +5,7 @@ import java.util.Map;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.SStore;
import share.system.domain.SStoreConsumer;
/**
* 门店Service接口
......@@ -77,4 +78,10 @@ public interface ISStoreService extends IService<SStore>
* @return 门店集合
*/
public List<Map> optionList(List<Long> ids);
int deleteStoreConsumer(SStoreConsumer storeConsumer);
int deleteStoreConsumers(Long storeId, Long[] consumerIds);
int insertStoreConsumers(Long storeId, Long[] consumerIds);
}
......@@ -14,6 +14,8 @@ import share.system.request.RegisterThirdSConsumerRequest;
*/
public interface SConsumerService extends IService<SConsumer>
{
List<SConsumer> selectAllocatedList(SConsumer sConsumer);
/**
* 查询会员用户
*
......@@ -84,4 +86,5 @@ public interface SConsumerService extends IService<SConsumer>
SConsumer registerByThird(RegisterThirdSConsumerRequest thirdUserRequest);
List<SConsumer> selectUnallocatedList(SConsumer sConsumer);
}
......@@ -4,8 +4,10 @@ import java.util.List;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.SConsumer;
import share.system.mapper.SCleanRecordsMapper;
import share.system.domain.SCleanRecords;
import share.system.mapper.SConsumerMapper;
import share.system.service.ISCleanRecordsService;
/**
......@@ -19,6 +21,8 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService
{
@Autowired
private SCleanRecordsMapper sCleanRecordsMapper;
@Autowired
private SConsumerMapper sConsumerMapper;
/**
* 查询保洁记录
......@@ -93,4 +97,43 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService
{
return sCleanRecordsMapper.deleteSCleanRecordsById(id);
}
/**
* 房间订单结束后自动调用此接口生成保洁任务
* @param storeId 门店id
* @param roomId 房间id
* @return
*/
@Override
public boolean addSCleanRecords(Long storeId, Long roomId) {
SCleanRecords sCleanRecords = new SCleanRecords();
sCleanRecords.setStoreId(storeId);
sCleanRecords.setRoomId(roomId);
sCleanRecords.setStatus(0);
sCleanRecords.setCreateTime(DateUtils.getNowDate());
boolean b = 0 < sCleanRecordsMapper.insertSCleanRecords(sCleanRecords);
if (b) {
sendSms(storeId);
}
return b;
}
@Override
public List<SCleanRecords> unCleanList(SCleanRecords sCleanRecords) {
return sCleanRecordsMapper.unCleanList(sCleanRecords);
}
@Override
public List<SCleanRecords> myCleanList(SCleanRecords sCleanRecords) {
return sCleanRecordsMapper.myCleanList(sCleanRecords);
}
private void sendSms(Long storeId) {
List<SConsumer> list = sConsumerMapper.selectListByStoreId(storeId);
for (SConsumer consumer : list) {
// 循环发送短信提示门店保洁打扫卫生
// todo
}
}
}
......@@ -30,6 +30,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
@Autowired
private SConsumerMapper sConsumerMapper;
/**
* 查询会员用户
*
......@@ -138,8 +139,26 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
String avatar = thirdSConsumerRequest.getAvatar();
user.setAvatar(avatar);
user.setSex(Integer.parseInt(thirdSConsumerRequest.getSex()));
user.setSex(thirdSConsumerRequest.getSex());
user.setAddres(thirdSConsumerRequest.getCountry() + "," + thirdSConsumerRequest.getProvince() + "," + thirdSConsumerRequest.getCity());
return user;
}
/**
* 查询已分配保洁人员列表
* @param sConsumer
* @return
*/
@Override
public List<SConsumer> selectAllocatedList(SConsumer sConsumer) {
return sConsumerMapper.selectAllocatedList(sConsumer);
}
/**
* 查询未分配保洁列表
*/
@Override
public List<SConsumer> selectUnallocatedList(SConsumer sConsumer) {
return sConsumerMapper.selectUnallocatedList(sConsumer);
}
}
......@@ -11,6 +11,9 @@ import org.apache.commons.collections4.CollectionUtils;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.SStoreConsumer;
import share.system.domain.SysUserRole;
import share.system.mapper.SStoreConsumerMapper;
import share.system.mapper.SStoreMapper;
import share.system.domain.SStore;
import share.system.service.ISStoreService;
......@@ -26,6 +29,8 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
{
@Autowired
private SStoreMapper sStoreMapper;
@Autowired
private SStoreConsumerMapper storeConsumerMapper;
/**
* 查询门店
......@@ -113,6 +118,30 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
return convertOptionList(storeList);
}
@Override
public int deleteStoreConsumer(SStoreConsumer storeConsumer) {
return storeConsumerMapper.deleteInfo(storeConsumer);
}
@Override
public int deleteStoreConsumers(Long storeId, Long[] consumerIds) {
return storeConsumerMapper.deleteInfos(storeId,consumerIds);
}
@Override
public int insertStoreConsumers(Long storeId, Long[] consumerIds) {
// 新增保洁与门店关系
List<SStoreConsumer> list = new ArrayList<SStoreConsumer>();
for (Long consumerId : consumerIds)
{
SStoreConsumer sc = new SStoreConsumer();
sc.setStoreId(storeId);
sc.setConsumerId(consumerId);
list.add(sc);
}
return storeConsumerMapper.batchSStoreConsumer(list);
}
private List<Map> convertOptionList(List<SStore> storeList){
List<Map> result = new ArrayList<>();
if(CollectionUtils.isNotEmpty(storeList)) {
......
......@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SCleanRecords" id="SCleanRecordsResult">
<result property="id" column="id" />
<result property="storeId" column="store_id" />
<result property="roomId" column="room_id" />
<result property="consumerId" column="consumer_id" />
<result property="startDate" column="start_date" />
......@@ -18,31 +19,76 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="storeName" column="store_name" />
<result property="roomName" column="room_name" />
<result property="cleanName" column="clean_name" />
<result property="phone" column="phone" />
</resultMap>
<sql id="selectSCleanRecordsVo">
select id, room_id, consumer_id, start_date, start_image, end_date, end_image, status, create_by, create_time, update_by, update_time, remark from s_clean_records
select t1.id, t1.store_id, t1.room_id, t1.consumer_id, t1.start_date, t1.start_image, t1.end_date, t1.end_image,
t1.status, t1.create_by, t1.create_time, t1.update_by, t1.update_time, t1.remark,
t2.name as store_name,
t3.name as room_name,
t4.nick_name as clean_name, t4.phone as phone
from s_clean_records t1
left join s_store t2 on t1.store_id = t2.id
left join s_room t3 on t1.room_id = t3.id
left join s_consumer t4 on t1.consumer_id = t4.id
</sql>
<select id="selectSCleanRecordsList" parameterType="SCleanRecords" resultMap="SCleanRecordsResult">
<include refid="selectSCleanRecordsVo"/>
<where>
<if test="startDate != null "> and start_date = #{startDate}</if>
<if test="startImage != null and startImage != ''"> and start_image = #{startImage}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="endImage != null and endImage != ''"> and end_image = #{endImage}</if>
<if test="status != null "> and status = #{status}</if>
<if test="startDate != null "> and t1.start_date = #{startDate}</if>
<if test="startImage != null and startImage != ''"> and t1.start_image = #{startImage}</if>
<if test="endDate != null "> and t1.end_date = #{endDate}</if>
<if test="endImage != null and endImage != ''"> and t1.end_image = #{endImage}</if>
<if test="status != null "> and t1.status = #{status}</if>
<if test="consumerId != null"> and t1.consumer_id = #{consumerId}</if>
<if test="roomId != null"> and t1.room_id = #{roomId}</if>
<if test="storeId != null"> and t1.store_id = #{storeId}</if>
</where>
</select>
<select id="selectSCleanRecordsById" parameterType="Long" resultMap="SCleanRecordsResult">
<include refid="selectSCleanRecordsVo"/>
where id = #{id}
where t1.id = #{id}
</select>
<select id="unCleanList" parameterType="SCleanRecords" resultMap="SCleanRecordsResult">
select t1.id, t1.store_id, t1.room_id, t1.consumer_id, t1.start_date, t1.start_image, t1.end_date, t1.end_image,
t1.status, t1.create_by, t1.create_time, t1.update_by, t1.update_time, t1.remark,
t2.name as store_name,
t3.name as room_name,
t4.nick_name as clean_name, t4.phone as phone
from s_clean_records t1
left join s_store t2 on t1.store_id = t2.id
left join s_room t3 on t1.room_id = t3.id
left join s_consumer t4 on t1.consumer_id = t4.id
where t1.status = 0 and
t1.store_id in (select store_id from s_store_consumer where consumer_id = #{consumerId})
<if test="storeName != null and storeName != ''"> and t2.name = #{storeName}</if>
</select>
<select id="myCleanList" parameterType="SCleanRecords" resultMap="SCleanRecordsResult">
select t1.id, t1.store_id, t1.room_id, t1.consumer_id, t1.start_date, t1.start_image, t1.end_date, t1.end_image,
t1.status, t1.create_by, t1.create_time, t1.update_by, t1.update_time, t1.remark,
t2.name as store_name,
t3.name as room_name,
t4.nick_name as clean_name, t4.phone as phone
from s_clean_records t1
left join s_store t2 on t1.store_id = t2.id
left join s_room t3 on t1.room_id = t3.id
left join s_consumer t4 on t1.consumer_id = t4.id
where t1.consumer_id = #{consumerId}
<if test="status != null "> and t1.status = #{status}</if>
<if test="storeName != null and storeName != ''"> and t2.name = #{storeName}</if>
</select>
<insert id="insertSCleanRecords" parameterType="SCleanRecords" useGeneratedKeys="true" keyProperty="id">
insert into s_clean_records
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="storeId != null">store_id,</if>
<if test="roomId != null">room_id,</if>
<if test="consumerId != null">consumer_id,</if>
<if test="startDate != null">start_date,</if>
......@@ -57,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storeId != null">#{storeId},</if>
<if test="roomId != null">#{roomId},</if>
<if test="consumerId != null">#{consumerId},</if>
<if test="startDate != null">#{startDate},</if>
......@@ -75,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateSCleanRecords" parameterType="SCleanRecords">
update s_clean_records
<trim prefix="SET" suffixOverrides=",">
<if test="storeId != null">store_id = #{storeId},</if>
<if test="roomId != null">room_id = #{roomId},</if>
<if test="consumerId != null">consumer_id = #{consumerId},</if>
<if test="startDate != null">start_date = #{startDate},</if>
......
......@@ -37,6 +37,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectAllocatedList" parameterType="SConsumer" resultMap="SConsumerResult">
select t1.id, t1.open_id, t1.nick_name, t1.phone, t1.level, t1.role_type, t1.sex, t1.amount,
t1.free_amount, t1.total_times, t1.duration
from s_consumer t1
left join s_store_consumer t2 on t2.consumer_id = t1.id
where t1.role_type = '1' and t2.store_id = #{storeId}
<if test="nickName != null and nickName != ''">
AND t1.nick_name like concat('%', #{nickName}, '%')
</if>
<if test="phone != null and phone != ''">
AND t1.phone like concat('%', #{phone}, '%')
</if>
</select>
<select id="selectUnallocatedList" parameterType="SConsumer" resultMap="SConsumerResult">
select t1.id, t1.open_id, t1.nick_name, t1.phone, t1.level, t1.role_type, t1.sex, t1.amount,
t1.free_amount, t1.total_times, t1.duration
from s_consumer t1
left join s_store_consumer t2 on t2.consumer_id = t1.id
where t1.role_type = '1' and t1.id not in (select consumer_id from s_store_consumer where store_id = #{storeId})
<if test="nickName != null and nickName != ''">
AND t1.nick_name like concat('%', #{nickName}, '%')
</if>
<if test="phone != null and phone != ''">
AND t1.phone like concat('%', #{phone}, '%')
</if>
</select>
<select id="selectListByStoreId" parameterType="Long" resultMap="SConsumerResult">
select t1.id, t1.open_id, t1.nick_name, t1.phone, t1.level, t1.role_type, t1.sex, t1.amount,
t1.free_amount, t1.total_times, t1.duration
from s_consumer t1
left join s_store_consumer t2 on t2.consumer_id = t1.id
where t1.role_type = '1' and t1.id in (select consumer_id from s_store_consumer where store_id = #{storeId})
</select>
<select id="selectSConsumerById" parameterType="Long" resultMap="SConsumerResult">
<include refid="selectSConsumerVo"/>
where id = #{id}
......
<?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.SStoreConsumerMapper">
<resultMap type="SStoreConsumer" id="SStoreConsumerResult">
<result property="storeId" column="store_id" />
<result property="consumerId" column="consumer_id" />
</resultMap>
<delete id="deleteByConsumerId" parameterType="Long">
delete from s_store_consumer where consumer_id=#{consumerId}
</delete>
<select id="countByStoreId" resultType="Integer">
select count(1) from s_store_consumer where store_id=#{storeId}
</select>
<delete id="deleteSStoreConsumer" parameterType="Long">
delete from s_store_consumer where consumer_id in
<foreach collection="array" item="consumerId" open="(" separator="," close=")">
#{consumerId}
</foreach>
</delete>
<insert id="batchSStoreConsumer">
insert into s_store_consumer(consumer_id, store_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.consumerId},#{item.storeId})
</foreach>
</insert>
<delete id="deleteInfo" parameterType="SStoreConsumer">
delete from s_store_consumer where consumer_id=#{consumerId} and store_id=#{storeId}
</delete>
<delete id="deleteInfos">
delete from s_store_consumer where store_id=#{storeId} and consumer_id in
<foreach collection="consumerIds" item="consumerId" open="(" separator="," close=")">
#{consumerId}
</foreach>
</delete>
</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