Commit e1d74d5a authored by 燕南天's avatar 燕南天

Merge branch 'master' of gitlab.fqyxa.com:luoyangfei/store-system

parents 3ea75da1 6d880f79
package cn.com.fqy.controller.mapi; package cn.com.fqy.controller.mapi;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.ResultInfo; import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.common.constants.Constant; import cn.com.fqy.common.constants.Constant;
import cn.com.fqy.core.common.PageFinder; import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Advert;
import cn.com.fqy.core.model.Query; import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store; import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker; import cn.com.fqy.core.model.Worker;
...@@ -67,8 +67,9 @@ public class WebWorkerController { ...@@ -67,8 +67,9 @@ public class WebWorkerController {
*/ */
@RequestMapping("workerDetails") @RequestMapping("workerDetails")
@ResponseBody @ResponseBody
public ResultInfo<Worker> workerDetails(String workerId){ public ResultInfo<Map<String,Object>> workerDetails(String workerId){
ResultInfo<Worker> resultInfo = new ResultInfo<>(); ResultInfo<Map<String,Object>> resultInfo = new ResultInfo<>();
Map<String,Object> map = new HashMap<>();
if(workerId == null || "".equals(workerId)) { if(workerId == null || "".equals(workerId)) {
resultInfo.setCode("0"); resultInfo.setCode("0");
resultInfo.setMsg("员工参数为空"); resultInfo.setMsg("员工参数为空");
...@@ -76,8 +77,38 @@ public class WebWorkerController { ...@@ -76,8 +77,38 @@ public class WebWorkerController {
} }
Worker res = workerService.getWorker(workerId); Worker res = workerService.getWorker(workerId);
if (null != res ) { if (null != res ) {
Store store = storeService.getStore(res.getStoreId());
if(null != store) {
map.put("workerId",res.getWorkerId());
map.put("workerName",res.getWorkerName());
map.put("workerAge",res.getWorkerAge());
map.put("workerNumber",res.getWorkerNumber());
map.put("workerBirthday",res.getWorkerBirthday());
map.put("workerAncestral",res.getWorkerAncestral());
map.put("workerBust",res.getWorkerBust());
map.put("workerHeight",res.getWorkerHeight());
map.put("workerHipline",res.getWorkerHipline());
map.put("workerHomePic",res.getWorkerHomePic());
map.put("workerPic",res.getWorkerPic());
map.put("workerResume",res.getWorkerResume());
map.put("workerSex",res.getWorkerSex());
map.put("workerWaist",res.getWorkerWaist());
map.put("workerWeight",res.getWorkerWeight());
map.put("storeId",res.getStoreId());
map.put("brief",res.getBrief());
map.put("clicks",res.getClicks());
map.put("matureTime",res.getMatureTime());
map.put("serialNumber",res.getSerialNumber());
map.put("storeName",res.getStoreName());
map.put("storeBrief",store.getBrief());
map.put("storeCityName",store.getCityName());
map.put("storeProvince",store.getProvince());
map.put("storeCounty",store.getCounty());
map.put("storeHomePic",store.getStoreHomePic());
map.put("storePosition",store.getStorePosition());
}
resultInfo.setCode("1"); resultInfo.setCode("1");
resultInfo.setData(res); resultInfo.setData(map);
}else { }else {
resultInfo.setCode("0"); resultInfo.setCode("0");
resultInfo.setMsg("员工信息丢失"); resultInfo.setMsg("员工信息丢失");
......
package cn.com.fqy.controller.mgt; package cn.com.fqy.controller.mgt;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.Operator; import cn.com.fqy.common.Operator;
import cn.com.fqy.common.ResultInfo; import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.core.common.BaseController; import cn.com.fqy.core.common.BaseController;
import cn.com.fqy.core.common.PageFinder; import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Query; import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store; import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.SysUser; import cn.com.fqy.core.model.SysUser;
import cn.com.fqy.core.service.StoreService; import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.SysUserService; import cn.com.fqy.core.service.StoreService;
@Controller import cn.com.fqy.core.service.SysUserService;
@RequestMapping("store") @Controller
public class StoreController extends BaseController { @RequestMapping("store")
public class StoreController extends BaseController {
@Resource
private StoreService storeService; @Resource
@Resource private StoreService storeService;
private SysUserService sysUserService; @Resource
/* private SysUserService sysUserService;
* 分页展示店铺信息 /*
*/ * 分页展示店铺信息
@RequestMapping("storeList") */
@ResponseBody @RequestMapping("storeList")
public PageFinder<Store> storeList(Store store,Query query) { @ResponseBody
store.setIsDeleted(0); public PageFinder<Store> storeList(Store store,Query query) {
SysUser user = sysUserService.detail(store.getUserId()); store.setIsDeleted(0);
if (user!=null) { SysUser user = sysUserService.detail(store.getUserId());
if ("1".equals(user.getFlag())) { if (user!=null) {
store.setUserId(""); if ("1".equals(user.getFlag())) {
} store.setUserId("");
} }
Query q = new Query(query.getPageNo(),query.getPageSize(),store); }
return storeService.getStorePagedList(q); Query q = new Query(query.getPageNo(),query.getPageSize(),store);
} return storeService.getStorePagedList(q);
}
/**
* 添加或修改店铺信息 /**
* @param CarPreiod * 添加或修改店铺信息
* @return * @param CarPreiod
*/ * @return
@RequestMapping("addOrEditStore") */
@ResponseBody @RequestMapping("addOrEditStore")
public ResultInfo<Store> addOrEditStore(Store store) { @ResponseBody
ResultInfo<Store> resultInfo = new ResultInfo<>(); public ResultInfo<Store> addOrEditStore(Store store) {
//操作人 ResultInfo<Store> resultInfo = new ResultInfo<>();
Operator op = getOperator(); //操作人
if (store!=null&&store.getStoreId()!=null&&!"".equals(store.getStoreId())) { Operator op = getOperator();
resultInfo = storeService.updateStore(store, op); if (store!=null&&store.getStoreId()!=null&&!"".equals(store.getStoreId())) {
}else { resultInfo = storeService.updateStore(store, op);
}else {
resultInfo = storeService.addStore(store, op); if(store.getUserId() == null || "".equals(store.getUserId())) {
} resultInfo.setCode("0");
return resultInfo; resultInfo.setMsg("系统用户id为空");
} return resultInfo;
}
/** resultInfo = storeService.addStore(store, op);
* 店铺删除 }
* @param workerId return resultInfo;
* @return }
*/
@RequestMapping("delStore") /**
@ResponseBody * 店铺删除
public ResultInfo<Store> delStore(String storeId ) { * @param workerId
ResultInfo<Store> resultInfo = new ResultInfo<>(); * @return
if(storeId == null || "".equals(storeId)) { */
resultInfo.setCode("0"); @RequestMapping("delStore")
resultInfo.setMsg("店铺ID参数为空"); @ResponseBody
return resultInfo; public ResultInfo<Store> delStore(String storeId ) {
} ResultInfo<Store> resultInfo = new ResultInfo<>();
Store store = new Store(); if(storeId == null || "".equals(storeId)) {
store.setIsDeleted(1); resultInfo.setCode("0");
store.setStoreId(storeId); resultInfo.setMsg("店铺ID参数为空");
return storeService.updateStore(store, getOperator()); return resultInfo;
} }
Store store = new Store();
/** store.setIsDeleted(1);
* 获取店铺信息 store.setStoreId(storeId);
*/ return storeService.updateStore(store, getOperator());
@RequestMapping("getStores") }
@ResponseBody
public ResultInfo<List<Map<String,Object>>> getStores(){ /**
ResultInfo<List<Map<String,Object>>> result = new ResultInfo<>(); * 获取店铺信息
List<Map<String,Object>> listQuery = new ArrayList<>(); */
Store store = new Store(); @RequestMapping("getStores")
store.setIsDeleted(0); @ResponseBody
store.setIsAuditing(1); public ResultInfo<List<Map<String,Object>>> getStores(){
List<Store> storeList = storeService.getStoreList(new Query(store)); ResultInfo<List<Map<String,Object>>> result = new ResultInfo<>();
if (storeList.size()>0 && storeList !=null) { List<Map<String,Object>> listQuery = new ArrayList<>();
for(Store list: storeList) { Store store = new Store();
Map<String,Object> map = new HashMap<>(); store.setIsDeleted(0);
map.put("storeId", list.getStoreId()); store.setIsAuditing(1);
map.put("storeName",list.getStoreName()); List<Store> storeList = storeService.getStoreList(new Query(store));
listQuery.add(map); if (storeList.size()>0 && storeList !=null) {
} for(Store list: storeList) {
if(listQuery.size()>0 && listQuery != null) { Map<String,Object> map = new HashMap<>();
result.setCode("1"); map.put("storeId", list.getStoreId());
result.setData(listQuery); map.put("storeName",list.getStoreName());
}else { listQuery.add(map);
result.setCode("0"); }
result.setMsg("暂无可用店铺数据"); if(listQuery.size()>0 && listQuery != null) {
} result.setCode("1");
}else { result.setData(listQuery);
result.setCode("0"); }else {
result.setMsg("暂无店铺数据"); result.setCode("0");
} result.setMsg("暂无可用店铺数据");
return result; }
} }else {
} result.setCode("0");
result.setMsg("暂无店铺数据");
}
return result;
}
/**
* 批量审核
* @param workerIds
* @return
*/
@RequestMapping("batchStores")
@ResponseBody
public ResultInfo<Store> batchStores(String[] storeIds) {
return storeService.batchStoreUpdate(storeIds, getOperator());
}
/**
* 批量展示
* @param workerIds
* @return
*/
@RequestMapping("batchStoreShop")
@ResponseBody
public ResultInfo<Store> batchStoreShop(String[] storeIds) {
return storeService.batchStoreShopping(storeIds, getOperator());
}
}
...@@ -80,7 +80,7 @@ public class SysUserController extends BaseController { ...@@ -80,7 +80,7 @@ public class SysUserController extends BaseController {
sysUser.setMobilePhone(sysUserRoleIds.getMobilePhone()); sysUser.setMobilePhone(sysUserRoleIds.getMobilePhone());
sysUser.setSex(sysUserRoleIds.getSex()); sysUser.setSex(sysUserRoleIds.getSex());
sysUser.setDeptId(sysUserRoleIds.getDeptId()); sysUser.setDeptId(sysUserRoleIds.getDeptId());
sysUser.setAdministratorsId(sysUserRoleIds.getAdministratorsId()); // sysUser.setAdministratorsId(sysUserRoleIds.getAdministratorsId());
if (sysUserRoleIds.getSysRole()!=null) { if (sysUserRoleIds.getSysRole()!=null) {
String[] roleIds = sysUserRoleIds.getSysRole(); String[] roleIds = sysUserRoleIds.getSysRole();
List<SysRole> sysRoles = new ArrayList<SysRole>(); List<SysRole> sysRoles = new ArrayList<SysRole>();
......
...@@ -6,6 +6,7 @@ import javax.annotation.Resource; ...@@ -6,6 +6,7 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.Operator; import cn.com.fqy.common.Operator;
...@@ -67,7 +68,11 @@ public class WorkerController extends BaseController { ...@@ -67,7 +68,11 @@ public class WorkerController extends BaseController {
if (worker!=null&&worker.getWorkerId()!=null&&!"".equals(worker.getWorkerId())) { if (worker!=null&&worker.getWorkerId()!=null&&!"".equals(worker.getWorkerId())) {
resultInfo = workerService.updateWorker(worker, op); resultInfo = workerService.updateWorker(worker, op);
}else { }else {
if(worker.getUserId() == null || "".equals(worker.getUserId())) {
resultInfo.setCode("0");
resultInfo.setMsg("系统用户id为空");
return resultInfo;
}
resultInfo = workerService.addWorker(worker, op); resultInfo = workerService.addWorker(worker, op);
} }
return resultInfo; return resultInfo;
...@@ -114,4 +119,25 @@ public class WorkerController extends BaseController { ...@@ -114,4 +119,25 @@ public class WorkerController extends BaseController {
} }
return result; return result;
} }
/**
* 批量审核
* @param workerIds
* @return
*/
@RequestMapping("batchWorkers")
@ResponseBody
public ResultInfo<Worker> batchWorkers(String[] workerIds) {
return workerService.batchWorkerUpdate(workerIds, getOperator());
}
/**
* 批量展示
* @param workerIds
* @return
*/
@RequestMapping("batchWorkerShop")
@ResponseBody
public ResultInfo<Worker> batchWorkerShop(String[] workerIds) {
return workerService.batchWorkerShopping(workerIds, getOperator());
}
} }
package cn.com.fqy.core.dao; package cn.com.fqy.core.dao;
import cn.com.fqy.core.common.BaseDao; import cn.com.fqy.core.common.BaseDao;
import cn.com.fqy.core.model.Store; import cn.com.fqy.core.model.Store;
/** /**
* Store 数据库处理类 * Store 数据库处理类
*/ */
public interface StoreDao extends BaseDao<Store,String> { public interface StoreDao extends BaseDao<Store,String> {
} public int updateAdByIds(String[] ids);
public int updateShopByIds(String[] ids);
}
package cn.com.fqy.core.dao; package cn.com.fqy.core.dao;
import java.util.List; import java.util.List;
import cn.com.fqy.core.common.BaseDao; import cn.com.fqy.core.common.BaseDao;
import cn.com.fqy.core.model.Worker; import cn.com.fqy.core.model.Worker;
/** /**
* Worker 数据库处理类 * Worker 数据库处理类
*/ */
public interface WorkerDao extends BaseDao<Worker,String> { public interface WorkerDao extends BaseDao<Worker,String> {
/** /**
* 根据 一组ID 查询返回一个对象集合 * 根据 一组ID 查询返回一个对象集合
* @param ids * @param ids
* @return * @return
*/ */
public List<Worker> getWorkerByIds(String[] ids); public List<Worker> getWorkerByIds(String[] ids);
}
public int updateAdByIds(String[] ids);
public int updateShopByIds(String[] ids);
}
package cn.com.fqy.core.service; package cn.com.fqy.core.service;
import java.util.List; import java.util.List;
import cn.com.fqy.common.Operator; import cn.com.fqy.common.Operator;
import cn.com.fqy.common.ResultInfo; import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.core.common.BaseService; import cn.com.fqy.core.common.BaseService;
import cn.com.fqy.core.common.PageFinder; import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Query; import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store; import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
/**
* Store 服务接口类 /**
*/ * Store 服务接口类
public interface StoreService extends BaseService { */
public interface StoreService extends BaseService {
/**
* 根据查询条件,查询并返回Store的列表 /**
* @param q 查询条件 * 根据查询条件,查询并返回Store的列表
* @return * @param q 查询条件
*/ * @return
public List<Store> getStoreList(Query q); */
public List<Store> getStoreList(Query q);
/**
* 根据查询条件,分页查询并返回Store的分页结果 /**
* @param q 查询条件 * 根据查询条件,分页查询并返回Store的分页结果
* @return * @param q 查询条件
*/ * @return
public PageFinder<Store> getStorePagedList(Query q); */
public PageFinder<Store> getStorePagedList(Query q);
/**
* 根据主键,查询并返回一个Store对象 /**
* @param id 主键id * 根据主键,查询并返回一个Store对象
* @return * @param id 主键id
*/ * @return
public Store getStore(String id); */
public Store getStore(String id);
/**
* 根据主键数组,查询并返回一组Store对象 /**
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度 * 根据主键数组,查询并返回一组Store对象
* @return * @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
*/ * @return
public List<Store> getStoreByIds(String[] ids); */
public List<Store> getStoreByIds(String[] ids);
/**
* 根据主键,删除特定的Store记录 /**
* @param id 主键id * 根据主键,删除特定的Store记录
* @param operator 操作人对象 * @param id 主键id
* @return * @param operator 操作人对象
*/ * @return
public ResultInfo<Store> delStore(String id, Operator operator); */
public ResultInfo<Store> delStore(String id, Operator operator);
/**
* 新增一条Store记录,执行成功后传入对象及返回对象的主键属性值不为null /**
* @param store 新增的Store数据(如果无特殊需求,新增对象的主键值请保留为null) * 新增一条Store记录,执行成功后传入对象及返回对象的主键属性值不为null
* @param operator 操作人对象 * @param store 新增的Store数据(如果无特殊需求,新增对象的主键值请保留为null)
* @return * @param operator 操作人对象
*/ * @return
public ResultInfo<Store> addStore(Store store, Operator operator); */
public ResultInfo<Store> addStore(Store store, Operator operator);
/**
* 根据主键,更新一条Store记录 /**
* @param store 更新的Store数据,且其主键不能为空 * 根据主键,更新一条Store记录
* @param operator 操作人对象 * @param store 更新的Store数据,且其主键不能为空
* @return * @param operator 操作人对象
*/ * @return
public ResultInfo<Store> updateStore(Store store, Operator operator); */
public ResultInfo<Store> updateStore(Store store, Operator operator);
/**
* 生成主键 /**
* @return * 生成主键
*/ * @return
public String generatePK(); */
public String generatePK();
/**
* 为Store对象设置默认值 /**
* @param obj * 为Store对象设置默认值
*/ * @param obj
public void fillDefaultValues(Store obj); */
public void fillDefaultValues(Store obj);
}
/**
* 根据 一组ID 修改一组数据
* @param workerId
* @return
*/
public ResultInfo<Store> batchStoreUpdate(String[] storeIds,Operator operator);
public ResultInfo<Store> batchStoreShopping(String[] storeIds,Operator operator);
}
package cn.com.fqy.core.service; package cn.com.fqy.core.service;
import java.util.List; import java.util.List;
import cn.com.fqy.common.Operator; import cn.com.fqy.common.Operator;
import cn.com.fqy.common.ResultInfo; import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.core.common.BaseService; import cn.com.fqy.core.common.BaseService;
import cn.com.fqy.core.common.PageFinder; import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Query; import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Worker; import cn.com.fqy.core.model.SysUser;
import cn.com.fqy.core.model.Worker;
/**
* Worker 服务接口类 /**
*/ * Worker 服务接口类
public interface WorkerService extends BaseService { */
public interface WorkerService extends BaseService {
/**
* 根据查询条件,查询并返回Worker的列表 /**
* @param q 查询条件 * 根据查询条件,查询并返回Worker的列表
* @return * @param q 查询条件
*/ * @return
public List<Worker> getWorkerList(Query q); */
public List<Worker> getWorkerList(Query q);
/**
* 根据查询条件,分页查询并返回Worker的分页结果 /**
* @param q 查询条件 * 根据查询条件,分页查询并返回Worker的分页结果
* @return * @param q 查询条件
*/ * @return
public PageFinder<Worker> getWorkerPagedList(Query q); */
public PageFinder<Worker> getWorkerPagedList(Query q);
/**
* 根据主键,查询并返回一个Worker对象 /**
* @param id 主键id * 根据主键,查询并返回一个Worker对象
* @return * @param id 主键id
*/ * @return
public Worker getWorker(String id); */
public Worker getWorker(String id);
/**
* 根据主键数组,查询并返回一组Worker对象 /**
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度 * 根据主键数组,查询并返回一组Worker对象
* @return * @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
*/ * @return
public List<Worker> getWorkerByIds(String[] ids); */
public List<Worker> getWorkerByIds(String[] ids);
/**
* 根据主键,删除特定的Worker记录 /**
* @param id 主键id * 根据主键,删除特定的Worker记录
* @param operator 操作人对象 * @param id 主键id
* @return * @param operator 操作人对象
*/ * @return
public ResultInfo<Worker> delWorker(String id, Operator operator); */
public ResultInfo<Worker> delWorker(String id, Operator operator);
/**
* 新增一条Worker记录,执行成功后传入对象及返回对象的主键属性值不为null /**
* @param worker 新增的Worker数据(如果无特殊需求,新增对象的主键值请保留为null) * 新增一条Worker记录,执行成功后传入对象及返回对象的主键属性值不为null
* @param operator 操作人对象 * @param worker 新增的Worker数据(如果无特殊需求,新增对象的主键值请保留为null)
* @return * @param operator 操作人对象
*/ * @return
public ResultInfo<Worker> addWorker(Worker worker, Operator operator); */
public ResultInfo<Worker> addWorker(Worker worker, Operator operator);
/**
* 根据主键,更新一条Worker记录 /**
* @param worker 更新的Worker数据,且其主键不能为空 * 根据主键,更新一条Worker记录
* @param operator 操作人对象 * @param worker 更新的Worker数据,且其主键不能为空
* @return * @param operator 操作人对象
*/ * @return
public ResultInfo<Worker> updateWorker(Worker worker, Operator operator); */
public ResultInfo<Worker> updateWorker(Worker worker, Operator operator);
/**
* 生成主键 /**
* @return * 生成主键
*/ * @return
public String generatePK(); */
public String generatePK();
/**
* 为Worker对象设置默认值 /**
* @param obj * 为Worker对象设置默认值
*/ * @param obj
public void fillDefaultValues(Worker obj); */
public void fillDefaultValues(Worker obj);
/**
* 根据 一组ID 查询返回一个对象集合 /**
* @param ids * 根据 一组ID 查询返回一个对象集合
* @return * @param ids
*/ * @return
public List<Worker> getWorkerSByIds(String[] ids); */
public List<Worker> getWorkerSByIds(String[] ids);
} /**
* 根据 一组ID 修改一组数据
* @param workerId
* @return
*/
public ResultInfo<Worker> batchWorkerUpdate(String[] workerIds,Operator operator);
public ResultInfo<Worker> batchWorkerShopping(String[] workerIds,Operator operator);
}
...@@ -21,6 +21,7 @@ import cn.com.fqy.core.common.PageFinder; ...@@ -21,6 +21,7 @@ import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.dao.StoreDao; import cn.com.fqy.core.dao.StoreDao;
import cn.com.fqy.core.model.Query; import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store; import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.StoreService; import cn.com.fqy.core.service.StoreService;
/** /**
...@@ -298,4 +299,52 @@ public class StoreServiceImpl implements StoreService { ...@@ -298,4 +299,52 @@ public class StoreServiceImpl implements StoreService {
} }
} }
@Transactional
public ResultInfo<Store> batchStoreUpdate(String[] storeIds, Operator operator) {
ResultInfo<Store> resultInfo = new ResultInfo<Store>();
if (storeIds == null || storeIds.length == 0) {
log.info(Constant.ERR_MSG_INVALID_ARG + " storeIds is null or empty array.");
} else {
try {
//调用dao,根据主键数组查询
int count=storeDao.updateAdByIds(storeIds);
if (count > 0) {
resultInfo.setCode(Constant.SUCCESS);
} else {
resultInfo.setCode(Constant.FAIL);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED);
}
}
return resultInfo;
}
@Transactional
public ResultInfo<Store> batchStoreShopping(String[] storeIds, Operator operator) {
ResultInfo<Store> resultInfo = new ResultInfo<Store>();
if (storeIds == null || storeIds.length == 0) {
log.info(Constant.ERR_MSG_INVALID_ARG + " storeIds is null or empty array.");
} else {
try {
//调用dao,根据主键数组查询
int count=storeDao.updateShopByIds(storeIds);
if (count > 0) {
resultInfo.setCode(Constant.SUCCESS);
} else {
resultInfo.setCode(Constant.FAIL);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED);
}
}
return resultInfo;
}
} }
...@@ -82,13 +82,13 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -82,13 +82,13 @@ public class SysUserServiceImpl implements SysUserService {
sysUser.setIsDeleted(0); sysUser.setIsDeleted(0);
sysUser.setCreateTime(now); sysUser.setCreateTime(now);
sysUser.setUpdateTime(now); sysUser.setUpdateTime(now);
int count1 = sysUserDao.add(sysUser); sysUserDao.add(sysUser);
if(count1>0) { // if(count1>0) {
Administrators administrators = new Administrators(); // Administrators administrators = new Administrators();
administrators.setAdministratorsId(sysUser.getAdministratorsId()); // administrators.setAdministratorsId(sysUser.getAdministratorsId());
administrators.setSystemId(sysUser.getUserId()); // administrators.setSystemId(sysUser.getUserId());
administratorsDao.update(administrators); // administratorsDao.update(administrators);
} // }
for (int i = 0; i < sysUser.getSysRole().size(); i++) { for (int i = 0; i < sysUser.getSysRole().size(); i++) {
SysRole sysRole = sysUser.getSysRole().get(i); SysRole sysRole = sysUser.getSysRole().get(i);
...@@ -156,19 +156,19 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -156,19 +156,19 @@ public class SysUserServiceImpl implements SysUserService {
// 调用Dao执行更新操作,并判断更新语句执行结果 // 调用Dao执行更新操作,并判断更新语句执行结果
int count = sysUserDao.update(sysUser); int count = sysUserDao.update(sysUser);
if (count == 1) { if (count == 1) {
SysUser su = sysUserDao.get(userId); // SysUser su = sysUserDao.get(userId);
if(null != su) { // if(null != su) {
Administrators admin= new Administrators(); // Administrators admin= new Administrators();
admin.setAdministratorsId(su.getAdministratorsId()); // admin.setAdministratorsId(su.getAdministratorsId());
admin.setSystemId(null); // admin.setSystemId(null);
int count1=administratorsDao.update(admin); // int count1=administratorsDao.update(admin);
if(count1 == 1) { // if(count1 == 1) {
resultInfo.setCode(Constant.SUCCESS); // resultInfo.setCode(Constant.SUCCESS);
}else { // }else {
resultInfo.setCode(Constant.FAIL); // resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("未释放店铺管理员!"); // resultInfo.setMsg("未释放店铺管理员!");
} // }
} // }
resultInfo.setCode(Constant.SUCCESS); resultInfo.setCode(Constant.SUCCESS);
} else { } else {
resultInfo.setCode(Constant.FAIL); resultInfo.setCode(Constant.FAIL);
......
package cn.com.fqy.core.service.impl; package cn.com.fqy.core.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import cn.com.fqy.common.Operator; import cn.com.fqy.common.Operator;
import cn.com.fqy.common.ResultInfo; import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.common.constants.Constant; import cn.com.fqy.common.constants.Constant;
import cn.com.fqy.core.common.PageFinder; import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.dao.WorkerDao; import cn.com.fqy.core.dao.WorkerDao;
import cn.com.fqy.core.model.Query; import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Worker; import cn.com.fqy.core.model.SysUser;
import cn.com.fqy.core.service.WorkerService; import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.WorkerService;
/**
* Worker 服务实现类 /**
*/ * Worker 服务实现类
@Service */
public class WorkerServiceImpl implements WorkerService { @Service
public class WorkerServiceImpl implements WorkerService {
private static final Log log = LogFactory.getLog(WorkerServiceImpl.class);
private static final Log log = LogFactory.getLog(WorkerServiceImpl.class);
@Resource
private WorkerDao workerDao; @Resource
private WorkerDao workerDao;
/**
* 根据查询条件,查询并返回Worker的列表 /**
* @param q 查询条件 * 根据查询条件,查询并返回Worker的列表
* @return * @param q 查询条件
*/ * @return
@Transactional(propagation = Propagation.SUPPORTS) */
public List<Worker> getWorkerList(Query q) { @Transactional(propagation = Propagation.SUPPORTS)
List<Worker> list = null; public List<Worker> getWorkerList(Query q) {
try { List<Worker> list = null;
//直接调用Dao方法进行查询 try {
list = workerDao.queryAll(q); //直接调用Dao方法进行查询
} catch (Exception e) { list = workerDao.queryAll(q);
log.error(e.getMessage(), e); } catch (Exception e) {
} log.error(e.getMessage(), e);
//如list为null时,则改为返回一个空列表 }
list = list == null ? new ArrayList<Worker>(0) : list; //如list为null时,则改为返回一个空列表
return list; list = list == null ? new ArrayList<Worker>(0) : list;
} return list;
}
/**
* 根据查询条件,分页查询并返回Worker的分页结果 /**
* @param q 查询条件 * 根据查询条件,分页查询并返回Worker的分页结果
* @return * @param q 查询条件
*/ * @return
@Transactional(propagation = Propagation.SUPPORTS) */
public PageFinder<Worker> getWorkerPagedList(Query q) { @Transactional(propagation = Propagation.SUPPORTS)
PageFinder<Worker> page = new PageFinder<Worker>(); public PageFinder<Worker> getWorkerPagedList(Query q) {
PageFinder<Worker> page = new PageFinder<Worker>();
List<Worker> list = null;
long rowCount = 0L; List<Worker> list = null;
long rowCount = 0L;
try {
//调用dao查询满足条件的分页数据 try {
list = workerDao.pageList(q); //调用dao查询满足条件的分页数据
//调用dao统计满足条件的记录总数 list = workerDao.pageList(q);
rowCount = workerDao.count(q); //调用dao统计满足条件的记录总数
} catch (Exception e) { rowCount = workerDao.count(q);
log.error(e.getMessage(), e); } catch (Exception e) {
} log.error(e.getMessage(), e);
}
//如list为null时,则改为返回一个空列表
list = list == null ? new ArrayList<Worker>(0) : list; //如list为null时,则改为返回一个空列表
list = list == null ? new ArrayList<Worker>(0) : list;
//将分页数据和记录总数设置到分页结果对象中
page.setData(list); //将分页数据和记录总数设置到分页结果对象中
page.setRowCount(rowCount); page.setData(list);
page.setPageSize(q.getPageSize()); page.setRowCount(rowCount);
return page; page.setPageSize(q.getPageSize());
} return page;
}
/**
* 根据主键,查询并返回一个Worker对象 /**
* @param id 主键id * 根据主键,查询并返回一个Worker对象
* @return * @param id 主键id
*/ * @return
@Transactional(propagation = Propagation.SUPPORTS) */
public Worker getWorker(String id) { @Transactional(propagation = Propagation.SUPPORTS)
Worker obj = null; public Worker getWorker(String id) {
if (id == null || id.length() == 0) { //传入的主键无效时直接返回null Worker obj = null;
log.info(Constant.ERR_MSG_INVALID_ARG + " id = " + id); if (id == null || id.length() == 0) { //传入的主键无效时直接返回null
return obj; log.info(Constant.ERR_MSG_INVALID_ARG + " id = " + id);
} return obj;
try { }
//调用dao,根据主键查询 try {
obj = workerDao.get(id); //调用dao,根据主键查询
if(null != obj) { obj = workerDao.get(id);
if(obj.getClicks()== null || "".equals(obj.getClicks())) { if(null != obj) {
obj.setClicks(0); if(obj.getClicks()== null || "".equals(obj.getClicks())) {
} obj.setClicks(0);
Worker worker = new Worker(); }
worker.setWorkerId(obj.getWorkerId()); Worker worker = new Worker();
worker.setClicks(obj.getClicks()+1); worker.setWorkerId(obj.getWorkerId());
workerDao.update(worker); worker.setClicks(obj.getClicks()+1);
} workerDao.update(worker);
} catch (Exception e) { }
log.error(e.getMessage(), e); } catch (Exception e) {
} log.error(e.getMessage(), e);
}
return obj;
} return obj;
}
/**
* 根据主键数组,查询并返回一组Worker对象 /**
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度 * 根据主键数组,查询并返回一组Worker对象
* @return * @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
*/ * @return
@Transactional(propagation = Propagation.SUPPORTS) */
public List<Worker> getWorkerByIds(String[] ids) { @Transactional(propagation = Propagation.SUPPORTS)
List<Worker> list = null; public List<Worker> getWorkerByIds(String[] ids) {
if (ids == null || ids.length == 0) { List<Worker> list = null;
log.info(Constant.ERR_MSG_INVALID_ARG + " ids is null or empty array."); if (ids == null || ids.length == 0) {
} else { log.info(Constant.ERR_MSG_INVALID_ARG + " ids is null or empty array.");
try { } else {
//调用dao,根据主键数组查询 try {
list = workerDao.getByIds(ids); //调用dao,根据主键数组查询
} catch (Exception e) { list = workerDao.getByIds(ids);
log.error(e.getMessage(), e); } catch (Exception e) {
} log.error(e.getMessage(), e);
} }
}
//如list为null时,则改为返回一个空列表
list = list == null ? new ArrayList<Worker>(0) : list; //如list为null时,则改为返回一个空列表
list = list == null ? new ArrayList<Worker>(0) : list;
return list;
} return list;
}
/**
* 根据主键,删除特定的Worker记录 /**
* @param id 主键id * 根据主键,删除特定的Worker记录
* @param operator 操作人对象 * @param id 主键id
* @return * @param operator 操作人对象
*/ * @return
@Transactional */
public ResultInfo<Worker> delWorker(String id, Operator operator) { @Transactional
ResultInfo<Worker> resultInfo = new ResultInfo<Worker>(); public ResultInfo<Worker> delWorker(String id, Operator operator) {
if (id == null || id.length() == 0) { //传入的主键无效时直接返回失败结果 ResultInfo<Worker> resultInfo = new ResultInfo<Worker>();
resultInfo.setCode(Constant.FAIL); if (id == null || id.length() == 0) { //传入的主键无效时直接返回失败结果
resultInfo.setMsg(Constant.ERR_MSG_INVALID_ARG ); resultInfo.setCode(Constant.FAIL);
log.info(Constant.ERR_MSG_INVALID_ARG + " id = " + id); resultInfo.setMsg(Constant.ERR_MSG_INVALID_ARG );
return resultInfo; log.info(Constant.ERR_MSG_INVALID_ARG + " id = " + id);
} return resultInfo;
try { }
//调用Dao执行删除,并判断删除语句执行结果 try {
int count = workerDao.delete(id); //调用Dao执行删除,并判断删除语句执行结果
if (count > 0) { int count = workerDao.delete(id);
resultInfo.setCode(Constant.SUCCESS); if (count > 0) {
} else { resultInfo.setCode(Constant.SUCCESS);
resultInfo.setCode(Constant.FAIL); } else {
resultInfo.setMsg(Constant.ERR_MSG_DATA_NOT_EXISTS); resultInfo.setCode(Constant.FAIL);
} resultInfo.setMsg(Constant.ERR_MSG_DATA_NOT_EXISTS);
} catch (Exception e) { }
log.error(e.getMessage(), e); } catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); log.error(e.getMessage(), e);
resultInfo.setCode(Constant.FAIL); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED); resultInfo.setCode(Constant.FAIL);
} resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED);
return resultInfo; }
} return resultInfo;
}
/**
* 新增一条Worker记录,执行成功后传入对象及返回对象的主键属性值不为null /**
* @param worker 新增的Worker数据(如果无特殊需求,新增对象的主键值请保留为null) * 新增一条Worker记录,执行成功后传入对象及返回对象的主键属性值不为null
* @param operator 操作人对象 * @param worker 新增的Worker数据(如果无特殊需求,新增对象的主键值请保留为null)
* @return * @param operator 操作人对象
*/ * @return
@Transactional */
public ResultInfo<Worker> addWorker(Worker worker, Operator operator) { @Transactional
ResultInfo<Worker> resultInfo = new ResultInfo<Worker>(); public ResultInfo<Worker> addWorker(Worker worker, Operator operator) {
ResultInfo<Worker> resultInfo = new ResultInfo<Worker>();
if (worker == null) { //传入参数无效时直接返回失败结果
resultInfo.setCode(Constant.FAIL); if (worker == null) { //传入参数无效时直接返回失败结果
resultInfo.setMsg(Constant.ERR_MSG_INVALID_ARG ); resultInfo.setCode(Constant.FAIL);
log.info(Constant.ERR_MSG_INVALID_ARG + " worker = " + worker); resultInfo.setMsg(Constant.ERR_MSG_INVALID_ARG );
} else { log.info(Constant.ERR_MSG_INVALID_ARG + " worker = " + worker);
try { } else {
//如果传入参数的主键为null,则调用生成主键的方法获取新的主键 try {
if (worker.getWorkerId() == null || "".equals(worker.getWorkerId())) { //如果传入参数的主键为null,则调用生成主键的方法获取新的主键
worker.setWorkerId(this.generatePK()); if (worker.getWorkerId() == null || "".equals(worker.getWorkerId())) {
} worker.setWorkerId(this.generatePK());
//如果传入的操作人不为null,则设置新增记录的操作人类型和操作人id }
if (operator != null) { //如果传入的操作人不为null,则设置新增记录的操作人类型和操作人id
worker.setOperatorType(operator.getOperatorType()); if (operator != null) {
worker.setOperatorId(operator.getOperatorId()); worker.setOperatorType(operator.getOperatorType());
} worker.setOperatorId(operator.getOperatorId());
}
//设置创建时间和更新时间为当前时间
Date now = new Date(); //设置创建时间和更新时间为当前时间
worker.setCreateTime(now); Date now = new Date();
worker.setUpdateTime(now); worker.setCreateTime(now);
worker.setUpdateTime(now);
//填充默认值
this.fillDefaultValues(worker); //填充默认值
this.fillDefaultValues(worker);
//调用Dao执行插入操作
workerDao.add(worker); //调用Dao执行插入操作
resultInfo.setCode(Constant.SUCCESS); workerDao.add(worker);
resultInfo.setData(worker); resultInfo.setCode(Constant.SUCCESS);
} catch (Exception e) { resultInfo.setData(worker);
log.error(e.getMessage(), e); } catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); log.error(e.getMessage(), e);
resultInfo.setCode(Constant.FAIL); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED); resultInfo.setCode(Constant.FAIL);
} resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED);
} }
}
return resultInfo;
} return resultInfo;
}
/**
* 根据主键,更新一条Worker记录 /**
* @param worker 更新的Worker数据,且其主键不能为空 * 根据主键,更新一条Worker记录
* @param operator 操作人对象 * @param worker 更新的Worker数据,且其主键不能为空
* @return * @param operator 操作人对象
*/ * @return
@Transactional */
public ResultInfo<Worker> updateWorker(Worker worker, Operator operator) { @Transactional
ResultInfo<Worker> resultInfo = new ResultInfo<Worker>(); public ResultInfo<Worker> updateWorker(Worker worker, Operator operator) {
ResultInfo<Worker> resultInfo = new ResultInfo<Worker>();
if (worker == null || worker.getWorkerId() == null) { //传入参数无效时直接返回失败结果
resultInfo.setCode(Constant.FAIL); if (worker == null || worker.getWorkerId() == null) { //传入参数无效时直接返回失败结果
resultInfo.setMsg(Constant.ERR_MSG_INVALID_ARG ); resultInfo.setCode(Constant.FAIL);
log.info(Constant.ERR_MSG_INVALID_ARG + " worker = " + worker); resultInfo.setMsg(Constant.ERR_MSG_INVALID_ARG );
} else { log.info(Constant.ERR_MSG_INVALID_ARG + " worker = " + worker);
try { } else {
//如果传入的操作人不为null,则设置更新记录的操作人类型和操作人id try {
if (operator != null) { //如果传入的操作人不为null,则设置更新记录的操作人类型和操作人id
worker.setOperatorType(operator.getOperatorType()); if (operator != null) {
worker.setOperatorId(operator.getOperatorId()); worker.setOperatorType(operator.getOperatorType());
} worker.setOperatorId(operator.getOperatorId());
}
//设置更新时间为当前时间
worker.setUpdateTime(new Date()); //设置更新时间为当前时间
worker.setUpdateTime(new Date());
//调用Dao执行更新操作,并判断更新语句执行结果
int count = workerDao.update(worker); //调用Dao执行更新操作,并判断更新语句执行结果
if (count > 0) { int count = workerDao.update(worker);
resultInfo.setCode(Constant.SUCCESS); if (count > 0) {
} else { resultInfo.setCode(Constant.SUCCESS);
resultInfo.setCode(Constant.FAIL); } else {
} resultInfo.setCode(Constant.FAIL);
resultInfo.setData(worker); }
} catch (Exception e) { resultInfo.setData(worker);
log.error(e.getMessage(), e); } catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); log.error(e.getMessage(), e);
resultInfo.setCode(Constant.FAIL); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED); resultInfo.setCode(Constant.FAIL);
} resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED);
} }
}
return resultInfo;
} return resultInfo;
}
/**
* 生成主键 /**
* @return * 生成主键
*/ * @return
public String generatePK() { */
return String.valueOf(new Date().getTime() * 1000000 + new Random().nextInt(1000000)); public String generatePK() {
} return String.valueOf(new Date().getTime() * 1000000 + new Random().nextInt(1000000));
}
/**
* 为Worker对象设置默认值 /**
* @param obj * 为Worker对象设置默认值
*/ * @param obj
public void fillDefaultValues(Worker obj) { */
if (obj != null) { public void fillDefaultValues(Worker obj) {
if(obj.getIsAuditing() == null) { if (obj != null) {
obj.setIsAuditing(0); if(obj.getIsAuditing() == null) {
} obj.setIsAuditing(0);
if(obj.getIsDeleted() == null) { }
obj.setIsDeleted(0); if(obj.getIsDeleted() == null) {
} obj.setIsDeleted(0);
if(obj.getIsShopping() == null) { }
obj.setIsShopping(0); if(obj.getIsShopping() == null) {
} obj.setIsShopping(0);
if(obj.getIsRecommend() == null) { }
obj.setIsRecommend(0); if(obj.getIsRecommend() == null) {
} obj.setIsRecommend(0);
} }
} }
}
/**
* 根据主键数组,查询并返回一组Worker对象 /**
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度 * 根据主键数组,查询并返回一组Worker对象
* @return * @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
*/ * @return
@Transactional(propagation = Propagation.SUPPORTS) */
public List<Worker> getWorkerSByIds(String[] ids) { @Transactional(propagation = Propagation.SUPPORTS)
List<Worker> list = null; public List<Worker> getWorkerSByIds(String[] ids) {
if (ids == null || ids.length == 0) { List<Worker> list = null;
log.info(Constant.ERR_MSG_INVALID_ARG + " ids is null or empty array."); if (ids == null || ids.length == 0) {
} else { log.info(Constant.ERR_MSG_INVALID_ARG + " ids is null or empty array.");
try { } else {
//调用dao,根据主键数组查询 try {
list = workerDao.getWorkerByIds(ids); //调用dao,根据主键数组查询
} catch (Exception e) { list = workerDao.getWorkerByIds(ids);
log.error(e.getMessage(), e); } catch (Exception e) {
} log.error(e.getMessage(), e);
} }
}
//如list为null时,则改为返回一个空列表
list = list == null ? new ArrayList<Worker>(0) : list; //如list为null时,则改为返回一个空列表
list = list == null ? new ArrayList<Worker>(0) : list;
return list;
} return list;
} }
@Transactional
public ResultInfo<Worker> batchWorkerUpdate(String[] workerIds,Operator operator) {
ResultInfo<Worker> resultInfo = new ResultInfo<Worker>();
if (workerIds == null || workerIds.length == 0) {
log.info(Constant.ERR_MSG_INVALID_ARG + " workerIds is null or empty array.");
} else {
try {
//调用dao,根据主键数组查询
int count=workerDao.updateAdByIds(workerIds);
if (count > 0) {
resultInfo.setCode(Constant.SUCCESS);
} else {
resultInfo.setCode(Constant.FAIL);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED);
}
}
return resultInfo;
}
@Transactional
public ResultInfo<Worker> batchWorkerShopping(String[] workerIds, Operator operator) {
ResultInfo<Worker> resultInfo = new ResultInfo<Worker>();
if (workerIds == null || workerIds.length == 0) {
log.info(Constant.ERR_MSG_INVALID_ARG + " workerIds is null or empty array.");
} else {
try {
//调用dao,根据主键数组查询
int count=workerDao.updateShopByIds(workerIds);
if (count > 0) {
resultInfo.setCode(Constant.SUCCESS);
} else {
resultInfo.setCode(Constant.FAIL);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED);
}
}
return resultInfo;
}
}
...@@ -99,7 +99,7 @@ POWER,SYSTEM_ID,CREATE_TIME,UPDATE_TIME,OPERATOR_ID,OPERATOR_TYPE,ADMINISTRATORS ...@@ -99,7 +99,7 @@ POWER,SYSTEM_ID,CREATE_TIME,UPDATE_TIME,OPERATOR_ID,OPERATOR_TYPE,ADMINISTRATORS
<if test="power!=null and power!=''"> <if test="power!=null and power!=''">
POWER=#{power,jdbcType = VARCHAR}, POWER=#{power,jdbcType = VARCHAR},
</if> </if>
<if test="systemId!=''"> <if test="systemId!=null and systemId!=''">
SYSTEM_ID=#{systemId,jdbcType = VARCHAR}, SYSTEM_ID=#{systemId,jdbcType = VARCHAR},
</if> </if>
<if test="createTime!=null "> <if test="createTime!=null ">
......
...@@ -258,6 +258,18 @@ CITY_NAME,CITY_ID,PROVINCE_ID,COUNTY_ID,BRIEF ...@@ -258,6 +258,18 @@ CITY_NAME,CITY_ID,PROVINCE_ID,COUNTY_ID,BRIEF
</where> </where>
</update> </update>
<update id="updateAdByIds">
update T_STORE set IS_AUDITING=1
<where>
STORE_ID in <foreach item="item" index="index" collection="array" open="(" separator="," close=")">#{item}</foreach>
</where>
</update>
<update id="updateShopByIds">
update T_STORE set IS_SHOPPING=1
<where>
STORE_ID in <foreach item="item" index="index" collection="array" open="(" separator="," close=")">#{item}</foreach>
</where>
</update>
<delete id="delete"> <delete id="delete">
delete from T_STORE delete from T_STORE
<where> <where>
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
<result column="OPERATOR_ID" property="operatorId" javaType="java.lang.String" jdbcType="VARCHAR"/> <result column="OPERATOR_ID" property="operatorId" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="FLAG" property="flag" javaType="java.lang.String" jdbcType="VARCHAR"/> <result column="FLAG" property="flag" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="ADMINISTRATORS_ID" property="administratorsId" javaType="java.lang.String" jdbcType="VARCHAR"/> <result column="ADMINISTRATORS_ID" property="administratorsId" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="ADMINISTRATORS_NAME" property="administratorsName" javaType="java.lang.String" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<resultMap type="SysUser" id="SysUserAss" extends="SysUser"> <resultMap type="SysUser" id="SysUserAss" extends="SysUser">
<association property="sysRole" column="USER_ID" <association property="sysRole" column="USER_ID"
...@@ -164,11 +163,7 @@ ...@@ -164,11 +163,7 @@
</select> </select>
<select id="count2" parameterType="Query" resultType="Long"> <select id="count2" parameterType="Query" resultType="Long">
select select count(*) from T_SYS_USER
count(*)
FROM
t_sys_user u
LEFT JOIN t_administrators a ON u.ADMINISTRATORS_ID = a.ADMINISTRATORS_ID
<where> <where>
<include refid="listCommonWhere2"/> <include refid="listCommonWhere2"/>
</where> </where>
...@@ -190,12 +185,7 @@ ...@@ -190,12 +185,7 @@
</select> </select>
<select id="pageList2" parameterType="Query" resultMap="SysUserAss"> <select id="pageList2" parameterType="Query" resultMap="SysUserAss">
SELECT select * from T_SYS_USER
u.*,
a.ADMINISTRATORS_NAME
FROM
t_sys_user u
LEFT JOIN t_administrators a ON u.ADMINISTRATORS_ID = a.ADMINISTRATORS_ID
<where> <where>
<include refid="listCommonWhere2"/> <include refid="listCommonWhere2"/>
</where> </where>
...@@ -288,7 +278,7 @@ ...@@ -288,7 +278,7 @@
AND IS_AVAILABLE=#{q.isAvailable} AND IS_AVAILABLE=#{q.isAvailable}
</if> </if>
<if test="q.isDeleted!=null "> <if test="q.isDeleted!=null ">
AND u.IS_DELETED=#{q.isDeleted} AND IS_DELETED=#{q.isDeleted}
</if> </if>
<if test="q.createTime!=null "> <if test="q.createTime!=null ">
AND CREATE_TIME=#{q.createTime} AND CREATE_TIME=#{q.createTime}
......
...@@ -232,6 +232,18 @@ UPDATE_TIME,OPERATOR_ID,OPERATOR_TYPE,SERIAL_NUMBER,IS_DELETED,STORE_NAME,BRIEF ...@@ -232,6 +232,18 @@ UPDATE_TIME,OPERATOR_ID,OPERATOR_TYPE,SERIAL_NUMBER,IS_DELETED,STORE_NAME,BRIEF
</where> </where>
</update> </update>
<update id="updateAdByIds" >
update T_WORKER set IS_AUDITING=1
<where>
WORKER_ID in <foreach item="item" index="index" collection="array" open="(" separator="," close=")">#{item}</foreach>
</where>
</update>
<update id="updateShopByIds" >
update T_WORKER set IS_SHOPPING=1
<where>
WORKER_ID in <foreach item="item" index="index" collection="array" open="(" separator="," close=")">#{item}</foreach>
</where>
</update>
<delete id="delete"> <delete id="delete">
delete from T_WORKER delete from T_WORKER
<where> <where>
......
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