Commit 0e2c3755 by wuwenlong

门店管理优化

parent 57bd4ca4
package share.system.controller;
package share.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
......
package share.system.controller;
package share.web.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
......
package share.system.controller;
package share.web.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
......
package share.system.controller;
package share.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
......
package share.web.controller.system;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -16,16 +19,16 @@ 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.SStore;
import share.system.service.ISStoreService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
import share.system.domain.SStore;
/**
* 门店Controller
*
* @author ruoyi
* @date 2023-09-27
* @date 2023-10-11
*/
@RestController
@RequestMapping("/system/store")
......@@ -101,4 +104,15 @@ public class SStoreController extends BaseController
{
return toAjax(sStoreService.deleteSStoreByIds(ids));
}
/**
* 查询门店下拉列表
*/
@ApiOperation(value = "查询门店下拉列表", notes="查询条件同门店管理,返回key=门店ID,Value=门店名称的数组对象(result.Data=[{门店ID,门店名称}...])", response=AjaxResult.class)
@GetMapping("/optionList")
public AjaxResult optionList(SStore sStore)
{
return success(sStoreService.optionList(sStore));
}
}
package share.system.controller;
package share.web.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
......
......@@ -27,157 +27,157 @@ import io.swagger.annotations.ApiOperation;
*
* @author ruoyi
*/
@Api("用户信息管理")
@RestController
@RequestMapping("/test/user")
//@Api("用户信息管理")
//@RestController
//@RequestMapping("/test/user")
public class TestController extends BaseController
{
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
}
@ApiOperation("获取用户列表")
@GetMapping("/list")
public R<List<UserEntity>> userList()
{
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return R.ok(userList);
}
@ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@GetMapping("/{userId}")
public R<UserEntity> getUser(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
return R.ok(users.get(userId));
}
else
{
return R.fail("用户不存在");
}
}
@ApiOperation("新增用户")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
})
@PostMapping("/save")
public R<String> save(UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return R.fail("用户ID不能为空");
}
users.put(user.getUserId(), user);
return R.ok();
}
@ApiOperation("更新用户")
@PutMapping("/update")
public R<String> update(@RequestBody UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return R.fail("用户ID不能为空");
}
if (users.isEmpty() || !users.containsKey(user.getUserId()))
{
return R.fail("用户不存在");
}
users.remove(user.getUserId());
users.put(user.getUserId(), user);
return R.ok();
}
@ApiOperation("删除用户信息")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@DeleteMapping("/{userId}")
public R<String> delete(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
users.remove(userId);
return R.ok();
}
else
{
return R.fail("用户不存在");
}
}
}
@ApiModel(value = "UserEntity", description = "用户实体")
class UserEntity
{
@ApiModelProperty("用户ID")
private Integer userId;
@ApiModelProperty("用户名称")
private String username;
@ApiModelProperty("用户密码")
private String password;
@ApiModelProperty("用户手机")
private String mobile;
public UserEntity()
{
}
public UserEntity(Integer userId, String username, String password, String mobile)
{
this.userId = userId;
this.username = username;
this.password = password;
this.mobile = mobile;
}
public Integer getUserId()
{
return userId;
}
public void setUserId(Integer userId)
{
this.userId = userId;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getMobile()
{
return mobile;
}
public void setMobile(String mobile)
{
this.mobile = mobile;
}
// private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
// {
// users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
// users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
// }
//
// @ApiOperation("获取用户列表")
// @GetMapping("/list")
// public R<List<UserEntity>> userList()
// {
// List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
// return R.ok(userList);
// }
//
// @ApiOperation("获取用户详细")
// @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
// @GetMapping("/{userId}")
// public R<UserEntity> getUser(@PathVariable Integer userId)
// {
// if (!users.isEmpty() && users.containsKey(userId))
// {
// return R.ok(users.get(userId));
// }
// else
// {
// return R.fail("用户不存在");
// }
// }
//
// @ApiOperation("新增用户")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
// @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
// @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
// @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
// })
// @PostMapping("/save")
// public R<String> save(UserEntity user)
// {
// if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
// {
// return R.fail("用户ID不能为空");
// }
// users.put(user.getUserId(), user);
// return R.ok();
// }
//
// @ApiOperation("更新用户")
// @PutMapping("/update")
// public R<String> update(@RequestBody UserEntity user)
// {
// if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
// {
// return R.fail("用户ID不能为空");
// }
// if (users.isEmpty() || !users.containsKey(user.getUserId()))
// {
// return R.fail("用户不存在");
// }
// users.remove(user.getUserId());
// users.put(user.getUserId(), user);
// return R.ok();
// }
//
// @ApiOperation("删除用户信息")
// @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
// @DeleteMapping("/{userId}")
// public R<String> delete(@PathVariable Integer userId)
// {
// if (!users.isEmpty() && users.containsKey(userId))
// {
// users.remove(userId);
// return R.ok();
// }
// else
// {
// return R.fail("用户不存在");
// }
// }
//}
//
//@ApiModel(value = "UserEntity", description = "用户实体")
//class UserEntity
//{
// @ApiModelProperty("用户ID")
// private Integer userId;
//
// @ApiModelProperty("用户名称")
// private String username;
//
// @ApiModelProperty("用户密码")
// private String password;
//
// @ApiModelProperty("用户手机")
// private String mobile;
//
// public UserEntity()
// {
//
// }
//
// public UserEntity(Integer userId, String username, String password, String mobile)
// {
// this.userId = userId;
// this.username = username;
// this.password = password;
// this.mobile = mobile;
// }
//
// public Integer getUserId()
// {
// return userId;
// }
//
// public void setUserId(Integer userId)
// {
// this.userId = userId;
// }
//
// public String getUsername()
// {
// return username;
// }
//
// public void setUsername(String username)
// {
// this.username = username;
// }
//
// public String getPassword()
// {
// return password;
// }
//
// public void setPassword(String password)
// {
// this.password = password;
// }
//
// public String getMobile()
// {
// return mobile;
// }
//
// public void setMobile(String mobile)
// {
// this.mobile = mobile;
// }
}
......@@ -9,7 +9,7 @@ import share.common.core.domain.BaseEntity;
* 门店对象 s_store
*
* @author ruoyi
* @date 2023-09-27
* @date 2023-10-11
*/
public class SStore extends BaseEntity
{
......@@ -31,9 +31,11 @@ public class SStore extends BaseEntity
private String address;
/** 经度 */
@Excel(name = "经度")
private String longitude;
/** 纬度 */
@Excel(name = "纬度")
private String latitude;
/** 联系人 */
......@@ -48,6 +50,22 @@ public class SStore extends BaseEntity
@Excel(name = "门店详情")
private String info;
/** 营业状态 0:停业 1:正常营业 */
@Excel(name = "营业状态 0:停业 1:正常营业")
private String status;
/** 开始营业时间 */
@Excel(name = "开始营业时间")
private String openStartTime;
/** 结束营业时间 */
@Excel(name = "结束营业时间")
private String openEndTime;
/** 门店类型 1:标准店 2: 形象店 3:旗舰店 */
@Excel(name = "门店类型 1:标准店 2: 形象店 3:旗舰店")
private String storeType;
public void setId(Long id)
{
this.id = id;
......@@ -129,6 +147,42 @@ public class SStore extends BaseEntity
{
return info;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setOpenStartTime(String openStartTime)
{
this.openStartTime = openStartTime;
}
public String getOpenStartTime()
{
return openStartTime;
}
public void setOpenEndTime(String openEndTime)
{
this.openEndTime = openEndTime;
}
public String getOpenEndTime()
{
return openEndTime;
}
public void setStoreType(String storeType)
{
this.storeType = storeType;
}
public String getStoreType()
{
return storeType;
}
@Override
public String toString() {
......@@ -147,6 +201,10 @@ public class SStore extends BaseEntity
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("status", getStatus())
.append("openStartTime", getOpenStartTime())
.append("openEndTime", getOpenEndTime())
.append("storeType", getStoreType())
.toString();
}
}
......@@ -7,7 +7,7 @@ import share.system.domain.SStore;
* 门店Mapper接口
*
* @author ruoyi
* @date 2023-09-27
* @date 2023-10-11
*/
public interface SStoreMapper
{
......
package share.system.service;
import java.util.List;
import java.util.Map;
import share.system.domain.SStore;
/**
* 门店Service接口
*
* @author ruoyi
* @date 2023-09-27
* @date 2023-10-11
*/
public interface ISStoreService
{
......@@ -58,4 +60,12 @@ public interface ISStoreService
* @return 结果
*/
public int deleteSStoreById(Long id);
/**
* 查询门店下拉列表
*
* @param sStore 门店
* @return 门店集合
*/
public List<Map> optionList(SStore sStore);
}
package share.system.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -12,7 +18,7 @@ import share.system.service.ISStoreService;
* 门店Service业务层处理
*
* @author ruoyi
* @date 2023-09-27
* @date 2023-10-11
*/
@Service
public class SStoreServiceImpl implements ISStoreService
......@@ -93,4 +99,19 @@ public class SStoreServiceImpl implements ISStoreService
{
return sStoreMapper.deleteSStoreById(id);
}
@Override
public List<Map> optionList(SStore sStore) {
List<SStore> storeList = sStoreMapper.selectSStoreList(sStore);
List<Map> result = new ArrayList<>();
if(CollectionUtils.isNotEmpty(storeList)) {
result = storeList.stream().map(store -> {
Map<Long, String> map = new HashMap<Long, String>() {{
put(store.getId(), store.getName());
}};
return map;
}).collect(Collectors.toList());
}
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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.SStoreMapper">
<resultMap type="SStore" id="SStoreResult">
......@@ -19,20 +19,31 @@ 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="status" column="status" />
<result property="openStartTime" column="open_start_time" />
<result property="openEndTime" column="open_end_time" />
<result property="storeType" column="store_type" />
</resultMap>
<sql id="selectSStoreVo">
select id, name, images, address, longitude, latitude, manager, phone, info, create_by, create_time, update_by, update_time, remark from s_store
select id, name, images, address, longitude, latitude, manager, phone, info, create_by, create_time, update_by, update_time, remark, status, open_start_time, open_end_time, store_type from s_store
</sql>
<select id="selectSStoreList" parameterType="SStore" resultMap="SStoreResult">
<include refid="selectSStoreVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="images != null and images != ''"> and images = #{images}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="longitude != null and longitude != ''"> and longitude = #{longitude}</if>
<if test="latitude != null and latitude != ''"> and latitude = #{latitude}</if>
<if test="manager != null and manager != ''"> and manager = #{manager}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="info != null and info != ''"> and info = #{info}</if>
<if test="status != null "> and status = #{status}</if>
<if test="openStartTime != null "> and open_start_time = #{openStartTime}</if>
<if test="openEndTime != null "> and open_end_time = #{openEndTime}</if>
<if test="storeType != null "> and store_type = #{storeType}</if>
</where>
</select>
......@@ -57,6 +68,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="status != null">status,</if>
<if test="openStartTime != null">open_start_time,</if>
<if test="openEndTime != null">open_end_time,</if>
<if test="storeType != null">store_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
......@@ -72,6 +87,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="status != null">#{status},</if>
<if test="openStartTime != null">#{openStartTime},</if>
<if test="openEndTime != null">#{openEndTime},</if>
<if test="storeType != null">#{storeType},</if>
</trim>
</insert>
......@@ -91,6 +110,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="status != null">status = #{status},</if>
<if test="openStartTime != null">open_start_time = #{openStartTime},</if>
<if test="openEndTime != null">open_end_time = #{openEndTime},</if>
<if test="storeType != null">store_type = #{storeType},</if>
</trim>
where id = #{id}
</update>
......
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