Commit 0e2c3755 by wuwenlong

门店管理优化

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