'完成商户、商户门店'

dev-discount
199901012 4 years ago
parent fc3c6e5125
commit 7d49ac94c3
  1. 19
      hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java
  2. 196
      hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java
  3. 2
      hai-service/src/main/java/com/hai/common/exception/ErrorCode.java
  4. 48
      hai-service/src/main/java/com/hai/dao/HighMerchantStoreMapper.java
  5. 2
      hai-service/src/main/java/com/hai/dao/HighMerchantStoreMapperExt.java
  6. 42
      hai-service/src/main/java/com/hai/dao/HighMerchantStoreSqlProvider.java
  7. 8
      hai-service/src/main/java/com/hai/entity/HighMerchantStore.java
  8. 4
      hai-service/src/main/java/com/hai/entity/HighMerchantStoreExample.java
  9. 10
      hai-service/src/main/java/com/hai/model/UserInfoModel.java
  10. 36
      hai-service/src/main/java/com/hai/service/HighMerchantStoreService.java
  11. 4
      hai-service/src/main/java/com/hai/service/HighStoreService.java
  12. 4
      hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java
  13. 64
      hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java
  14. 5
      hai-service/src/main/java/com/hai/service/impl/HighStoreServiceImpl.java

@ -56,7 +56,6 @@ public class HighMerchantController {
@ApiOperation(value = "编辑商户") @ApiOperation(value = "编辑商户")
public ResponseData editMerchant(@RequestBody HighMerchant highMerchant, HttpServletRequest request) { public ResponseData editMerchant(@RequestBody HighMerchant highMerchant, HttpServletRequest request) {
try { try {
//发布人员
SessionObject sessionObject = userCenter.getSessionObject(request); SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (highMerchant.getCompanyId() == null if (highMerchant.getCompanyId() == null
@ -108,15 +107,21 @@ public class HighMerchantController {
@RequestMapping(value="/getMerchantList",method = RequestMethod.GET) @RequestMapping(value="/getMerchantList",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询商户列表") @ApiOperation(value = "查询商户列表")
public ResponseData getMerchantList(@RequestParam(name = "companyId", required = true) Long companyId, public ResponseData getMerchantList(@RequestParam(name = "merchantKey", required = false) String merchantKey,
@RequestParam(name = "merchantKey", required = true) String merchantKey, @RequestParam(name = "merchantName", required = false) String merchantName,
@RequestParam(name = "merchantName", required = true) String merchantName, @RequestParam(name = "telephone", required = false) String telephone,
@RequestParam(name = "telephone", required = true) String telephone,
@RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) { @RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try { try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getBsCompany() == null) {
log.error("HighMerchantController -> getMerchantList() error!","权限不足");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("companyId", companyId); map.put("companyId", userInfoModel.getBsCompany().getId());
map.put("merchantKey", merchantKey); map.put("merchantKey", merchantKey);
map.put("merchantName", merchantName); map.put("merchantName", merchantName);
map.put("telephone", telephone); map.put("telephone", telephone);

@ -0,0 +1,196 @@
package com.bweb.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighMerchant;
import com.hai.entity.HighMerchantStore;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighMerchantService;
import com.hai.service.HighMerchantStoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @Auther: 胡锐
* @Description:
* @Date: 2021/3/9 20:58
*/
@Controller
@RequestMapping(value = "/highMerchantStore")
@Api(value = "商户门店接口")
public class HighMerchantStoreController {
private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class);
@Autowired
private UserCenter userCenter;
@Resource
private HighMerchantStoreService highMerchantStoreService;
@Resource
private HighMerchantService highMerchantService;
@RequestMapping(value="/editHighMerchantStore",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "编辑商户门店")
public ResponseData editMerchantStore(@RequestBody HighMerchantStore highMerchantStore, HttpServletRequest request) {
try {
//发布人员
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (highMerchantStore.getMerchantId() == null
|| StringUtils.isNotBlank(highMerchantStore.getStoreKey())
|| StringUtils.isNotBlank(highMerchantStore.getStoreName())
|| StringUtils.isNotBlank(highMerchantStore.getTelephone())
|| StringUtils.isNotBlank(highMerchantStore.getAddress())
) {
log.error("HighMerchantStoreController -> editMerchantStore() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 商户
HighMerchant merchant = highMerchantService.getMerchantById(highMerchantStore.getMerchantId());
if (merchant != null) {
log.error("HighMerchantStoreController -> editMerchantStore() error!","未找到商户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, "");
}
if (highMerchantStore.getId() != null) {
highMerchantStore.setUpdateTime(new Date());
} else {
highMerchantStore.setCreateTime(new Date());
highMerchantStore.setUpdateTime(new Date());
}
highMerchantStore.setCompanyId(merchant.getCompanyId());
highMerchantStore.setStatus(1); // 状态:0:删除,1:正常
highMerchantStore.setOperatorId(userInfoModel.getSecUser().getId());
highMerchantStore.setOperatorName(userInfoModel.getSecUser().getUserName());
highMerchantStoreService.editMerchantStore(highMerchantStore);
return ResponseMsgUtil.success(highMerchantStore);
} catch (Exception e) {
log.error("HighMerchantStoreController -> editMerchantStore() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/deleteMerchantStore",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "删除商户门店")
public ResponseData deleteMerchantStore(@RequestParam(name = "id", required = true) Long id) {
try {
// 商户门店
HighMerchantStore merchantStore = highMerchantStoreService.getMerchantStoreById(id);
if(merchantStore == null) {
log.error("HighMerchantStoreController -> deleteMerchantStore() error!","未找到商户门店");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_STORE_NOF_FOUND, "");
}
merchantStore.setStatus(0);
merchantStore.setUpdateTime(new Date());
highMerchantStoreService.editMerchantStore(merchantStore);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighMerchantStoreController -> deleteMerchantStore() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getMerchantStoreById",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id查询商户门店")
public ResponseData getMerchantStoreById(@RequestParam(name = "id", required = true) Long id) {
try {
return ResponseMsgUtil.success(highMerchantStoreService.getMerchantStoreById(id));
} catch (Exception e) {
log.error("HighMerchantStoreController -> getMerchantStoreById() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getStoreListByCompany",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据公司 查询商户门店列表")
public ResponseData getStoreListByCompany(@RequestParam(name = "merchantId", required = false) Long merchantId,
@RequestParam(name = "telephone", required = false) String telephone,
@RequestParam(name = "storeName", required = false) String storeName,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getBsCompany() == null) {
log.error("HighMerchantStoreController -> getStoreListByCompany() error!","权限不足");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String, Object> map = new HashMap<>();
map.put("companyId", userInfoModel.getBsCompany().getId());
map.put("merchantId", merchantId);
map.put("telephone", telephone);
map.put("storeName", storeName);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highMerchantStoreService.getMerchantStoreList(map)));
} catch (Exception e) {
log.error("HighMerchantStoreController -> getStoreListByCompany() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getStoreListByMerchant",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据商户 查询门店列表")
public ResponseData getStoreListByMerchant(@RequestParam(name = "telephone", required = false) String telephone,
@RequestParam(name = "storeName", required = false) String storeName,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getMerchant() == null) {
log.error("HighMerchantStoreController -> getStoreListByMerchant() error!","权限不足");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String, Object> map = new HashMap<>();
map.put("merchantId", userInfoModel.getMerchant().getId());
map.put("telephone", telephone);
map.put("storeName", storeName);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highMerchantStoreService.getMerchantStoreList(map)));
} catch (Exception e) {
log.error("HighMerchantStoreController -> getStoreListByMerchant() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -75,11 +75,13 @@ public enum ErrorCode {
SMS_CODE_ERROR("2103","验证码错误"), SMS_CODE_ERROR("2103","验证码错误"),
ID_CARD_NUM_IS_ERROR("2104","身份证号码错误"), ID_CARD_NUM_IS_ERROR("2104","身份证号码错误"),
MERCHANT_NOF_FOUND("2105","未找到商户"), MERCHANT_NOF_FOUND("2105","未找到商户"),
MERCHANT_STORE_NOF_FOUND("2106","未找到商户门店"),
STATUS_ERROR("3000","状态错误"), STATUS_ERROR("3000","状态错误"),
ADD_DATA_ERROR("3001","增加数据失败"), ADD_DATA_ERROR("3001","增加数据失败"),
UPDATE_DATA_ERROR("3002","修改数据失败"), UPDATE_DATA_ERROR("3002","修改数据失败"),
DELETE_DATA_ERROR("3003","删除数据失败"), DELETE_DATA_ERROR("3003","删除数据失败"),
COMPETENCE_INSUFFICIENT("3004","权限不足"),
MSG_EVENT_NULL("2999","消息类型为空"), MSG_EVENT_NULL("2999","消息类型为空"),
USE_VISIT_ILLEGAL("4001","用户身份错误"), USE_VISIT_ILLEGAL("4001","用户身份错误"),

@ -1,7 +1,7 @@
package com.hai.dao; package com.hai.dao;
import com.hai.entity.HighStore; import com.hai.entity.HighMerchantStore;
import com.hai.entity.HighStoreExample; import com.hai.entity.HighMerchantStoreExample;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider; import org.apache.ibatis.annotations.DeleteProvider;
@ -25,21 +25,21 @@ import org.springframework.stereotype.Repository;
* *
**/ **/
@Repository @Repository
public interface HighStoreMapper extends HighStoreMapperExt { public interface HighMerchantStoreMapper extends HighMerchantStoreMapperExt {
@SelectProvider(type=HighStoreSqlProvider.class, method="countByExample") @SelectProvider(type=HighMerchantStoreSqlProvider.class, method="countByExample")
long countByExample(HighStoreExample example); long countByExample(HighMerchantStoreExample example);
@DeleteProvider(type=HighStoreSqlProvider.class, method="deleteByExample") @DeleteProvider(type=HighMerchantStoreSqlProvider.class, method="deleteByExample")
int deleteByExample(HighStoreExample example); int deleteByExample(HighMerchantStoreExample example);
@Delete({ @Delete({
"delete from high_store", "delete from high_merchant_store",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
@Insert({ @Insert({
"insert into high_store (company_id, merchant_id, ", "insert into high_merchant_store (company_id, merchant_id, ",
"store_key, store_name, ", "store_key, store_name, ",
"store_desc, telephone, ", "store_desc, telephone, ",
"address, `status`, ", "address, `status`, ",
@ -55,13 +55,13 @@ public interface HighStoreMapper extends HighStoreMapperExt {
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighStore record); int insert(HighMerchantStore record);
@InsertProvider(type=HighStoreSqlProvider.class, method="insertSelective") @InsertProvider(type=HighMerchantStoreSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(HighStore record); int insertSelective(HighMerchantStore record);
@SelectProvider(type=HighStoreSqlProvider.class, method="selectByExample") @SelectProvider(type=HighMerchantStoreSqlProvider.class, method="selectByExample")
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT), @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT),
@ -80,14 +80,14 @@ public interface HighStoreMapper extends HighStoreMapperExt {
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
}) })
List<HighStore> selectByExample(HighStoreExample example); List<HighMerchantStore> selectByExample(HighMerchantStoreExample example);
@Select({ @Select({
"select", "select",
"id, company_id, merchant_id, store_key, store_name, store_desc, telephone, address, ", "id, company_id, merchant_id, store_key, store_name, store_desc, telephone, address, ",
"`status`, operator_id, operator_name, update_time, create_time, ext_1, ext_2, ", "`status`, operator_id, operator_name, update_time, create_time, ext_1, ext_2, ",
"ext_3", "ext_3",
"from high_store", "from high_merchant_store",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@Results({ @Results({
@ -108,19 +108,19 @@ public interface HighStoreMapper extends HighStoreMapperExt {
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
}) })
HighStore selectByPrimaryKey(Long id); HighMerchantStore selectByPrimaryKey(Long id);
@UpdateProvider(type=HighStoreSqlProvider.class, method="updateByExampleSelective") @UpdateProvider(type=HighMerchantStoreSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") HighStore record, @Param("example") HighStoreExample example); int updateByExampleSelective(@Param("record") HighMerchantStore record, @Param("example") HighMerchantStoreExample example);
@UpdateProvider(type=HighStoreSqlProvider.class, method="updateByExample") @UpdateProvider(type=HighMerchantStoreSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") HighStore record, @Param("example") HighStoreExample example); int updateByExample(@Param("record") HighMerchantStore record, @Param("example") HighMerchantStoreExample example);
@UpdateProvider(type=HighStoreSqlProvider.class, method="updateByPrimaryKeySelective") @UpdateProvider(type=HighMerchantStoreSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(HighStore record); int updateByPrimaryKeySelective(HighMerchantStore record);
@Update({ @Update({
"update high_store", "update high_merchant_store",
"set company_id = #{companyId,jdbcType=BIGINT},", "set company_id = #{companyId,jdbcType=BIGINT},",
"merchant_id = #{merchantId,jdbcType=BIGINT},", "merchant_id = #{merchantId,jdbcType=BIGINT},",
"store_key = #{storeKey,jdbcType=VARCHAR},", "store_key = #{storeKey,jdbcType=VARCHAR},",
@ -138,5 +138,5 @@ public interface HighStoreMapper extends HighStoreMapperExt {
"ext_3 = #{ext3,jdbcType=VARCHAR}", "ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
int updateByPrimaryKey(HighStore record); int updateByPrimaryKey(HighMerchantStore record);
} }

@ -3,5 +3,5 @@ package com.hai.dao;
/** /**
* mapper扩展类 * mapper扩展类
*/ */
public interface HighStoreMapperExt { public interface HighMerchantStoreMapperExt {
} }

@ -1,32 +1,32 @@
package com.hai.dao; package com.hai.dao;
import com.hai.entity.HighStore; import com.hai.entity.HighMerchantStore;
import com.hai.entity.HighStoreExample.Criteria; import com.hai.entity.HighMerchantStoreExample.Criteria;
import com.hai.entity.HighStoreExample.Criterion; import com.hai.entity.HighMerchantStoreExample.Criterion;
import com.hai.entity.HighStoreExample; import com.hai.entity.HighMerchantStoreExample;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.ibatis.jdbc.SQL; import org.apache.ibatis.jdbc.SQL;
public class HighStoreSqlProvider { public class HighMerchantStoreSqlProvider {
public String countByExample(HighStoreExample example) { public String countByExample(HighMerchantStoreExample example) {
SQL sql = new SQL(); SQL sql = new SQL();
sql.SELECT("count(*)").FROM("high_store"); sql.SELECT("count(*)").FROM("high_merchant_store");
applyWhere(sql, example, false); applyWhere(sql, example, false);
return sql.toString(); return sql.toString();
} }
public String deleteByExample(HighStoreExample example) { public String deleteByExample(HighMerchantStoreExample example) {
SQL sql = new SQL(); SQL sql = new SQL();
sql.DELETE_FROM("high_store"); sql.DELETE_FROM("high_merchant_store");
applyWhere(sql, example, false); applyWhere(sql, example, false);
return sql.toString(); return sql.toString();
} }
public String insertSelective(HighStore record) { public String insertSelective(HighMerchantStore record) {
SQL sql = new SQL(); SQL sql = new SQL();
sql.INSERT_INTO("high_store"); sql.INSERT_INTO("high_merchant_store");
if (record.getCompanyId() != null) { if (record.getCompanyId() != null) {
sql.VALUES("company_id", "#{companyId,jdbcType=BIGINT}"); sql.VALUES("company_id", "#{companyId,jdbcType=BIGINT}");
@ -91,7 +91,7 @@ public class HighStoreSqlProvider {
return sql.toString(); return sql.toString();
} }
public String selectByExample(HighStoreExample example) { public String selectByExample(HighMerchantStoreExample example) {
SQL sql = new SQL(); SQL sql = new SQL();
if (example != null && example.isDistinct()) { if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id"); sql.SELECT_DISTINCT("id");
@ -113,7 +113,7 @@ public class HighStoreSqlProvider {
sql.SELECT("ext_1"); sql.SELECT("ext_1");
sql.SELECT("ext_2"); sql.SELECT("ext_2");
sql.SELECT("ext_3"); sql.SELECT("ext_3");
sql.FROM("high_store"); sql.FROM("high_merchant_store");
applyWhere(sql, example, false); applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) { if (example != null && example.getOrderByClause() != null) {
@ -124,11 +124,11 @@ public class HighStoreSqlProvider {
} }
public String updateByExampleSelective(Map<String, Object> parameter) { public String updateByExampleSelective(Map<String, Object> parameter) {
HighStore record = (HighStore) parameter.get("record"); HighMerchantStore record = (HighMerchantStore) parameter.get("record");
HighStoreExample example = (HighStoreExample) parameter.get("example"); HighMerchantStoreExample example = (HighMerchantStoreExample) parameter.get("example");
SQL sql = new SQL(); SQL sql = new SQL();
sql.UPDATE("high_store"); sql.UPDATE("high_merchant_store");
if (record.getId() != null) { if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("id = #{record.id,jdbcType=BIGINT}");
@ -200,7 +200,7 @@ public class HighStoreSqlProvider {
public String updateByExample(Map<String, Object> parameter) { public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL(); SQL sql = new SQL();
sql.UPDATE("high_store"); sql.UPDATE("high_merchant_store");
sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("company_id = #{record.companyId,jdbcType=BIGINT}"); sql.SET("company_id = #{record.companyId,jdbcType=BIGINT}");
@ -219,14 +219,14 @@ public class HighStoreSqlProvider {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
HighStoreExample example = (HighStoreExample) parameter.get("example"); HighMerchantStoreExample example = (HighMerchantStoreExample) parameter.get("example");
applyWhere(sql, example, true); applyWhere(sql, example, true);
return sql.toString(); return sql.toString();
} }
public String updateByPrimaryKeySelective(HighStore record) { public String updateByPrimaryKeySelective(HighMerchantStore record) {
SQL sql = new SQL(); SQL sql = new SQL();
sql.UPDATE("high_store"); sql.UPDATE("high_merchant_store");
if (record.getCompanyId() != null) { if (record.getCompanyId() != null) {
sql.SET("company_id = #{companyId,jdbcType=BIGINT}"); sql.SET("company_id = #{companyId,jdbcType=BIGINT}");
@ -293,7 +293,7 @@ public class HighStoreSqlProvider {
return sql.toString(); return sql.toString();
} }
protected void applyWhere(SQL sql, HighStoreExample example, boolean includeExamplePhrase) { protected void applyWhere(SQL sql, HighMerchantStoreExample example, boolean includeExamplePhrase) {
if (example == null) { if (example == null) {
return; return;
} }

@ -4,7 +4,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* high_store * high_merchant_store
* @author * @author
*/ */
/** /**
@ -12,7 +12,7 @@ import java.util.Date;
* 代码由工具生成 * 代码由工具生成
* *
**/ **/
public class HighStore implements Serializable { public class HighMerchantStore implements Serializable {
/** /**
* 主键 * 主键
*/ */
@ -54,7 +54,7 @@ public class HighStore implements Serializable {
private String address; private String address;
/** /**
* 状态0不可用1可用 * 状态0删除1正常
*/ */
private Integer status; private Integer status;
@ -225,7 +225,7 @@ public class HighStore implements Serializable {
if (getClass() != that.getClass()) { if (getClass() != that.getClass()) {
return false; return false;
} }
HighStore other = (HighStore) that; HighMerchantStore other = (HighMerchantStore) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())) && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
&& (this.getMerchantId() == null ? other.getMerchantId() == null : this.getMerchantId().equals(other.getMerchantId())) && (this.getMerchantId() == null ? other.getMerchantId() == null : this.getMerchantId().equals(other.getMerchantId()))

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
public class HighStoreExample { public class HighMerchantStoreExample {
protected String orderByClause; protected String orderByClause;
protected boolean distinct; protected boolean distinct;
@ -15,7 +15,7 @@ public class HighStoreExample {
private Long offset; private Long offset;
public HighStoreExample() { public HighMerchantStoreExample() {
oredCriteria = new ArrayList<Criteria>(); oredCriteria = new ArrayList<Criteria>();
} }

@ -24,6 +24,8 @@ public class UserInfoModel {
private SecRole secRole; private SecRole secRole;
// 公司 // 公司
private BsCompany bsCompany; private BsCompany bsCompany;
// 商户
private HighMerchant merchant;
// 权限列表 // 权限列表
private List<SecPermission> permissionList; private List<SecPermission> permissionList;
// 菜单权限列表 // 菜单权限列表
@ -33,6 +35,14 @@ public class UserInfoModel {
private String token; private String token;
public HighMerchant getMerchant() {
return merchant;
}
public void setMerchant(HighMerchant merchant) {
this.merchant = merchant;
}
public SecUser getSecUser() { public SecUser getSecUser() {
return secUser; return secUser;
} }

@ -0,0 +1,36 @@
package com.hai.service;
import com.hai.entity.HighMerchantStore;
import java.util.List;
import java.util.Map;
/**
* @Author 胡锐
* @Description 门店服务
* @Date 2021/3/9 20:15
**/
public interface HighMerchantStoreService {
/**
* @Author 胡锐
* @Description 编辑门店
* @Date 2021/3/9 20:26
**/
void editMerchantStore(HighMerchantStore highMerchantStore);
/**
* @Author 胡锐
* @Description 根据id查询
* @Date 2021/3/9 20:26
**/
HighMerchantStore getMerchantStoreById(Long id);
/**
* @Author 胡锐
* @Description 查询门店列表
* @Date 2021/3/9 20:26
**/
List<HighMerchantStore> getMerchantStoreList(Map<String, Object> map);
}

@ -1,4 +0,0 @@
package com.hai.service;
public interface HighStoreService {
}

@ -37,11 +37,11 @@ public class HighMerchantServiceImpl implements HighMerchantService {
HighMerchantExample example = new HighMerchantExample(); HighMerchantExample example = new HighMerchantExample();
HighMerchantExample.Criteria criteria = example.createCriteria(); HighMerchantExample.Criteria criteria = example.createCriteria();
if (map.get("companyId") != null) { if (MapUtils.getLong(map, "companyId") != null) {
criteria.andCompanyIdEqualTo(MapUtils.getLongValue(map, "companyId")); criteria.andCompanyIdEqualTo(MapUtils.getLongValue(map, "companyId"));
} }
if (map.get("merchantKey") != null) { if (MapUtils.getLong(map, "merchantKey") != null) {
criteria.andMerchantKeyEqualTo(MapUtils.getString(map, "merchantKey")); criteria.andMerchantKeyEqualTo(MapUtils.getString(map, "merchantKey"));
} }

@ -0,0 +1,64 @@
package com.hai.service.impl;
import com.hai.dao.HighMerchantStoreMapper;
import com.hai.entity.HighMerchantStore;
import com.hai.entity.HighMerchantStoreExample;
import com.hai.service.HighMerchantStoreService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service("highMerchantStoreService")
public class HighMerchantStoreServiceImpl implements HighMerchantStoreService {
@Resource
private HighMerchantStoreMapper highMerchantStoreMapper;
@Override
public void editMerchantStore(HighMerchantStore highMerchantStore) {
if (highMerchantStore.getId() != null) {
highMerchantStoreMapper.updateByPrimaryKey(highMerchantStore);
} else {
highMerchantStoreMapper.insert(highMerchantStore);
}
}
@Override
public HighMerchantStore getMerchantStoreById(Long id) {
return highMerchantStoreMapper.selectByPrimaryKey(id);
}
@Override
public List<HighMerchantStore> getMerchantStoreList(Map<String, Object> map) {
HighMerchantStoreExample example = new HighMerchantStoreExample();
HighMerchantStoreExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "companyId") != null) {
criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId"));
}
if (MapUtils.getLong(map, "merchantId") != null) {
criteria.andMerchantIdEqualTo(MapUtils.getLong(map, "merchantId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "storeKey"))) {
criteria.andStoreKeyEqualTo(MapUtils.getString(map, "storeKey"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "storeName"))) {
criteria.andStoreNameLike("%" + MapUtils.getString(map, "storeName") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "telephone"))) {
criteria.andTelephoneEqualTo("%" + MapUtils.getString(map, "telephone") + "%");
}
example.setOrderByClause("create_time desc");
return highMerchantStoreMapper.selectByExample(example);
}
}

@ -1,5 +0,0 @@
package com.hai.service.impl;
public class HighStoreServiceImpl {
}
Loading…
Cancel
Save