Compare commits
2 Commits
0455cd52ab
...
74600b4e78
| Author | SHA1 | Date |
|---|---|---|
|
|
74600b4e78 | 3 months ago |
|
|
15429ed270 | 3 months ago |
@ -0,0 +1,316 @@ |
||||
package com.bweb.controller.goods; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.security.UserCenter; |
||||
import com.hfkj.common.utils.ResponseMsgUtil; |
||||
import com.hfkj.entity.GoodsAutoRel; |
||||
import com.hfkj.entity.GoodsAutoTask; |
||||
import com.hfkj.model.ResponseData; |
||||
import com.hfkj.model.SecUserSessionObject; |
||||
import com.hfkj.service.goods.GoodsAutoRelService; |
||||
import com.hfkj.service.goods.GoodsAutoTaskService; |
||||
import com.hfkj.service.goods.GoodsMsgService; |
||||
import com.hfkj.sysenum.SecUserObjectTypeEnum; |
||||
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.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.naming.NamingEnumeration; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/goodsAuto") |
||||
@Api(value="商品自动上下架") |
||||
public class GoodsAutoController { |
||||
private static final Logger log = LoggerFactory.getLogger(GoodsAutoController.class); |
||||
|
||||
@Resource |
||||
private GoodsAutoRelService goodsAutoRelService; |
||||
|
||||
@Resource |
||||
private GoodsAutoTaskService goodsAutoTaskService; |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@RequestMapping(value="/queryList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询列表") |
||||
public ResponseData queryList(@RequestParam(value = "taskTitle" , required = false) String taskTitle, |
||||
@RequestParam(value = "listingTime" , required = false) Long listingTime, |
||||
@RequestParam(value = "removalTime" , required = false) Long removalTime, |
||||
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
||||
@RequestParam(value = "pageSize" , required = true) Integer pageSize) { |
||||
try { |
||||
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||
if (sessionModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||
} |
||||
|
||||
Map<String,Object> param = new HashMap<>(); |
||||
param.put("taskTitle", taskTitle); |
||||
param.put("listingTime", listingTime); |
||||
param.put("removalTime", removalTime); |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(goodsAutoTaskService.getList(param))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/goodsAutoTask",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "创建商品自动上架任务") |
||||
public ResponseData createGoodPresent(@RequestBody GoodsAutoTask body, HttpServletRequest request) { |
||||
|
||||
try { |
||||
|
||||
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||
// 检查sessionModel是否为空,如果为空则抛出账号未登录异常
|
||||
if (sessionModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||
} |
||||
|
||||
// 检查当前用户是否为指定类型(type1),如果不是则抛出无权限异常
|
||||
if (!sessionModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); |
||||
} |
||||
|
||||
// 检查请求参数是否完整,包括上架时间、下架时间和任务标题是否为空
|
||||
if (body == null |
||||
|| body.getType() == null |
||||
|| StringUtils.isBlank(body.getTaskTitle()) |
||||
) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
if (body.getType() == 1) { |
||||
if (body.getListingTime() == null || body.getInventory() == null) |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
if (body.getType() == 2) { |
||||
if (body.getRemovalTime() == null) |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
// 设置创建时间为当前时间
|
||||
body.setCreateTime(new Date()); |
||||
// 设置创建用户ID为当前登录用户的ID
|
||||
body.setCreateUserId(sessionModel.getAccount().getId()); |
||||
// 设置创建用户名为当前登录用户的用户名
|
||||
body.setCreateUserName(sessionModel.getAccount().getUserName()); |
||||
// 设置任务状态为1
|
||||
body.setStatus(1); |
||||
|
||||
// 调用服务层方法创建商品自动任务
|
||||
goodsAutoTaskService.create(body); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
|
||||
} |
||||
|
||||
@RequestMapping(value="/delete",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "删除") |
||||
public ResponseData delete(@RequestParam(value = "id" , required = false) Long id) { |
||||
try { |
||||
|
||||
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||
if (sessionModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||
} |
||||
|
||||
|
||||
// 创建GoodsAutoTask对象,通过id查询任务详情
|
||||
GoodsAutoTask goodsAutoTask = goodsAutoTaskService.queryDetail(id); |
||||
// 判断任务是否存在,如果不存在则抛出异常
|
||||
if (goodsAutoTask == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "任务不存在"); |
||||
} |
||||
|
||||
// 查询 任务关联商品内容
|
||||
Map<String , Object> map = new HashMap<>(); |
||||
map.put("taskId" , id); |
||||
// 从goodsAutoRelService中获取符合条件的数据列表
|
||||
List<GoodsAutoRel> list = goodsAutoRelService.getList(map); |
||||
|
||||
// 判断列表是否为null或空列表
|
||||
if (list != null && !list.isEmpty()) { |
||||
// 遍历列表中的每个元素
|
||||
for (GoodsAutoRel goodsAutoRel : list) { |
||||
// 删除每个元素对应的记录,第二个参数false表示不进行某种操作(可能是事务或日志记录)
|
||||
goodsAutoRelService.delete(goodsAutoRel.getId() , false); |
||||
} |
||||
} |
||||
|
||||
// 删除指定ID的goodsAutoTask记录,第二个参数false同样表示不进行某种操作
|
||||
goodsAutoTaskService.delete(id , false); |
||||
|
||||
return ResponseMsgUtil.success("删除成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/goodsTaskRel",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "自动任务关联商品") |
||||
public ResponseData goodsTaskRel(@RequestBody JSONObject body) { |
||||
|
||||
try { |
||||
|
||||
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||
// 检查sessionModel是否为空,如果为空则抛出账号未登录异常
|
||||
if (sessionModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||
} |
||||
|
||||
// 检查当前用户是否为指定类型(type1),如果不是则抛出无权限异常
|
||||
if (!sessionModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); |
||||
} |
||||
|
||||
// 检查请求参数是否完整
|
||||
if (body == null |
||||
|| body.getLong("taskId") == null |
||||
|| StringUtils.isBlank(body.getString("goodsIds")) |
||||
) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
goodsAutoRelService.goodsTaskRel(body.getLong("taskId"), body.getString("goodsIds"), sessionModel.getAccount().getId(), sessionModel.getAccount().getUserName()); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
|
||||
} |
||||
|
||||
@RequestMapping(value="/deleteRel",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "删除关联内容") |
||||
public ResponseData deleteRel(@RequestParam(value = "id" , required = false) Long id) { |
||||
try { |
||||
|
||||
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||
if (sessionModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||
} |
||||
|
||||
// 创建GoodsAutoTask对象,通过id查询任务详情
|
||||
GoodsAutoRel goodsAutoRel = goodsAutoRelService.queryDetail(id); |
||||
// 判断任务是否存在,如果不存在则抛出异常
|
||||
if (goodsAutoRel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "任务不存在"); |
||||
} |
||||
|
||||
goodsAutoRelService.delete(id , false); |
||||
|
||||
return ResponseMsgUtil.success("删除成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryListTaskGoodsRel",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询列表") |
||||
public ResponseData queryListTaskGoodsRel(@RequestParam(value = "taskId" , required = false) Long taskId) { |
||||
try { |
||||
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||
if (sessionModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||
} |
||||
|
||||
Map<String,Object> param = new HashMap<>(); |
||||
param.put("taskId", taskId); |
||||
|
||||
return ResponseMsgUtil.success(goodsAutoRelService.getList(param)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getListingTimeList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "定时查询上架任务") |
||||
public ResponseData getListingTimeList() { |
||||
try { |
||||
|
||||
List<GoodsAutoTask> list = goodsAutoTaskService.getListingTimeList(); |
||||
|
||||
if (!list.isEmpty()) { |
||||
for (GoodsAutoTask goodsAutoTask : list) { |
||||
// 当前时间是否满足上架时间
|
||||
if(goodsAutoTask.getListingTime() != null) { |
||||
// 执行逻辑
|
||||
goodsAutoTaskService.startListingTask(goodsAutoTask , 1); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
return ResponseMsgUtil.success("成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getRemovalTimeList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "定时查询下架任务") |
||||
public ResponseData getRemovalTimeList() { |
||||
try { |
||||
|
||||
List<GoodsAutoTask> list = goodsAutoTaskService.getRemovalTimeList(); |
||||
|
||||
for (GoodsAutoTask goodsAutoTask : list) { |
||||
// 当前时间是否满足上架时间
|
||||
if(goodsAutoTask.getRemovalTime() != null) { |
||||
// 执行逻辑
|
||||
goodsAutoTaskService.startListingTask(goodsAutoTask , 2); |
||||
} |
||||
} |
||||
|
||||
return ResponseMsgUtil.success("成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,155 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.GoodsAutoRel; |
||||
import com.hfkj.entity.GoodsAutoRelExample; |
||||
import java.util.List; |
||||
import org.apache.ibatis.annotations.Delete; |
||||
import org.apache.ibatis.annotations.DeleteProvider; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.InsertProvider; |
||||
import org.apache.ibatis.annotations.Options; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Result; |
||||
import org.apache.ibatis.annotations.Results; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.SelectProvider; |
||||
import org.apache.ibatis.annotations.Update; |
||||
import org.apache.ibatis.annotations.UpdateProvider; |
||||
import org.apache.ibatis.type.JdbcType; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
/** |
||||
* |
||||
* 代码由工具生成,请勿修改!!! |
||||
* 如果需要扩展请在其父类进行扩展 |
||||
* |
||||
**/ |
||||
@Repository |
||||
public interface GoodsAutoRelMapper extends GoodsAutoRelMapperExt { |
||||
@SelectProvider(type=GoodsAutoRelSqlProvider.class, method="countByExample") |
||||
long countByExample(GoodsAutoRelExample example); |
||||
|
||||
@DeleteProvider(type=GoodsAutoRelSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(GoodsAutoRelExample example); |
||||
|
||||
@Delete({ |
||||
"delete from goods_auto_rel", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into goods_auto_rel (`type`, goods_id, ", |
||||
"goods_name, task_id, ", |
||||
"task_title, listing_time, ", |
||||
"removal_time, `status`, ", |
||||
"remak, create_time, ", |
||||
"update_time, create_user_id, ", |
||||
"create_user_name, update_user_id, ", |
||||
"update_user_name, ext_1, ", |
||||
"ext_2, ext_3)", |
||||
"values (#{type,jdbcType=INTEGER}, #{goodsId,jdbcType=BIGINT}, ", |
||||
"#{goodsName,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, ", |
||||
"#{taskTitle,jdbcType=VARCHAR}, #{listingTime,jdbcType=TIMESTAMP}, ", |
||||
"#{removalTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", |
||||
"#{remak,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", |
||||
"#{updateTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=BIGINT}, ", |
||||
"#{createUserName,jdbcType=VARCHAR}, #{updateUserId,jdbcType=BIGINT}, ", |
||||
"#{updateUserName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", |
||||
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(GoodsAutoRel record); |
||||
|
||||
@InsertProvider(type=GoodsAutoRelSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(GoodsAutoRel record); |
||||
|
||||
@SelectProvider(type=GoodsAutoRelSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="goods_id", property="goodsId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="goods_name", property="goodsName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="task_id", property="taskId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="task_title", property="taskTitle", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="listing_time", property="listingTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="removal_time", property="removalTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="remak", property="remak", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="create_user_name", property="createUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="update_user_id", property="updateUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="update_user_name", property="updateUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<GoodsAutoRel> selectByExample(GoodsAutoRelExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, `type`, goods_id, goods_name, task_id, task_title, listing_time, removal_time, ", |
||||
"`status`, remak, create_time, update_time, create_user_id, create_user_name, ", |
||||
"update_user_id, update_user_name, ext_1, ext_2, ext_3", |
||||
"from goods_auto_rel", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="goods_id", property="goodsId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="goods_name", property="goodsName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="task_id", property="taskId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="task_title", property="taskTitle", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="listing_time", property="listingTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="removal_time", property="removalTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="remak", property="remak", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="create_user_name", property="createUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="update_user_id", property="updateUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="update_user_name", property="updateUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
GoodsAutoRel selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=GoodsAutoRelSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") GoodsAutoRel record, @Param("example") GoodsAutoRelExample example); |
||||
|
||||
@UpdateProvider(type=GoodsAutoRelSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") GoodsAutoRel record, @Param("example") GoodsAutoRelExample example); |
||||
|
||||
@UpdateProvider(type=GoodsAutoRelSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(GoodsAutoRel record); |
||||
|
||||
@Update({ |
||||
"update goods_auto_rel", |
||||
"set `type` = #{type,jdbcType=INTEGER},", |
||||
"goods_id = #{goodsId,jdbcType=BIGINT},", |
||||
"goods_name = #{goodsName,jdbcType=VARCHAR},", |
||||
"task_id = #{taskId,jdbcType=BIGINT},", |
||||
"task_title = #{taskTitle,jdbcType=VARCHAR},", |
||||
"listing_time = #{listingTime,jdbcType=TIMESTAMP},", |
||||
"removal_time = #{removalTime,jdbcType=TIMESTAMP},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"remak = #{remak,jdbcType=VARCHAR},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||
"create_user_id = #{createUserId,jdbcType=BIGINT},", |
||||
"create_user_name = #{createUserName,jdbcType=VARCHAR},", |
||||
"update_user_id = #{updateUserId,jdbcType=BIGINT},", |
||||
"update_user_name = #{updateUserName,jdbcType=VARCHAR},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(GoodsAutoRel record); |
||||
} |
||||
@ -0,0 +1,7 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface GoodsAutoRelMapperExt { |
||||
} |
||||
@ -0,0 +1,430 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.GoodsAutoRel; |
||||
import com.hfkj.entity.GoodsAutoRelExample.Criteria; |
||||
import com.hfkj.entity.GoodsAutoRelExample.Criterion; |
||||
import com.hfkj.entity.GoodsAutoRelExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class GoodsAutoRelSqlProvider { |
||||
|
||||
public String countByExample(GoodsAutoRelExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("goods_auto_rel"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(GoodsAutoRelExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("goods_auto_rel"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(GoodsAutoRel record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("goods_auto_rel"); |
||||
|
||||
if (record.getType() != null) { |
||||
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getGoodsId() != null) { |
||||
sql.VALUES("goods_id", "#{goodsId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getGoodsName() != null) { |
||||
sql.VALUES("goods_name", "#{goodsName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getTaskId() != null) { |
||||
sql.VALUES("task_id", "#{taskId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getTaskTitle() != null) { |
||||
sql.VALUES("task_title", "#{taskTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getListingTime() != null) { |
||||
sql.VALUES("listing_time", "#{listingTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getRemovalTime() != null) { |
||||
sql.VALUES("removal_time", "#{removalTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getRemak() != null) { |
||||
sql.VALUES("remak", "#{remak,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateUserId() != null) { |
||||
sql.VALUES("create_user_id", "#{createUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCreateUserName() != null) { |
||||
sql.VALUES("create_user_name", "#{createUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserId() != null) { |
||||
sql.VALUES("update_user_id", "#{updateUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserName() != null) { |
||||
sql.VALUES("update_user_name", "#{updateUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String selectByExample(GoodsAutoRelExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("`type`"); |
||||
sql.SELECT("goods_id"); |
||||
sql.SELECT("goods_name"); |
||||
sql.SELECT("task_id"); |
||||
sql.SELECT("task_title"); |
||||
sql.SELECT("listing_time"); |
||||
sql.SELECT("removal_time"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("remak"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("create_user_id"); |
||||
sql.SELECT("create_user_name"); |
||||
sql.SELECT("update_user_id"); |
||||
sql.SELECT("update_user_name"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("goods_auto_rel"); |
||||
applyWhere(sql, example, false); |
||||
|
||||
if (example != null && example.getOrderByClause() != null) { |
||||
sql.ORDER_BY(example.getOrderByClause()); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExampleSelective(Map<String, Object> parameter) { |
||||
GoodsAutoRel record = (GoodsAutoRel) parameter.get("record"); |
||||
GoodsAutoRelExample example = (GoodsAutoRelExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("goods_auto_rel"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getType() != null) { |
||||
sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getGoodsId() != null) { |
||||
sql.SET("goods_id = #{record.goodsId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getGoodsName() != null) { |
||||
sql.SET("goods_name = #{record.goodsName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getTaskId() != null) { |
||||
sql.SET("task_id = #{record.taskId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getTaskTitle() != null) { |
||||
sql.SET("task_title = #{record.taskTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getListingTime() != null) { |
||||
sql.SET("listing_time = #{record.listingTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getRemovalTime() != null) { |
||||
sql.SET("removal_time = #{record.removalTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getRemak() != null) { |
||||
sql.SET("remak = #{record.remak,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateUserId() != null) { |
||||
sql.SET("create_user_id = #{record.createUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCreateUserName() != null) { |
||||
sql.SET("create_user_name = #{record.createUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserId() != null) { |
||||
sql.SET("update_user_id = #{record.updateUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserName() != null) { |
||||
sql.SET("update_user_name = #{record.updateUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExample(Map<String, Object> parameter) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("goods_auto_rel"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); |
||||
sql.SET("goods_id = #{record.goodsId,jdbcType=BIGINT}"); |
||||
sql.SET("goods_name = #{record.goodsName,jdbcType=VARCHAR}"); |
||||
sql.SET("task_id = #{record.taskId,jdbcType=BIGINT}"); |
||||
sql.SET("task_title = #{record.taskTitle,jdbcType=VARCHAR}"); |
||||
sql.SET("listing_time = #{record.listingTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("removal_time = #{record.removalTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("remak = #{record.remak,jdbcType=VARCHAR}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("create_user_id = #{record.createUserId,jdbcType=BIGINT}"); |
||||
sql.SET("create_user_name = #{record.createUserName,jdbcType=VARCHAR}"); |
||||
sql.SET("update_user_id = #{record.updateUserId,jdbcType=BIGINT}"); |
||||
sql.SET("update_user_name = #{record.updateUserName,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
|
||||
GoodsAutoRelExample example = (GoodsAutoRelExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(GoodsAutoRel record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("goods_auto_rel"); |
||||
|
||||
if (record.getType() != null) { |
||||
sql.SET("`type` = #{type,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getGoodsId() != null) { |
||||
sql.SET("goods_id = #{goodsId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getGoodsName() != null) { |
||||
sql.SET("goods_name = #{goodsName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getTaskId() != null) { |
||||
sql.SET("task_id = #{taskId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getTaskTitle() != null) { |
||||
sql.SET("task_title = #{taskTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getListingTime() != null) { |
||||
sql.SET("listing_time = #{listingTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getRemovalTime() != null) { |
||||
sql.SET("removal_time = #{removalTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getRemak() != null) { |
||||
sql.SET("remak = #{remak,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateUserId() != null) { |
||||
sql.SET("create_user_id = #{createUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCreateUserName() != null) { |
||||
sql.SET("create_user_name = #{createUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserId() != null) { |
||||
sql.SET("update_user_id = #{updateUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserName() != null) { |
||||
sql.SET("update_user_name = #{updateUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
protected void applyWhere(SQL sql, GoodsAutoRelExample example, boolean includeExamplePhrase) { |
||||
if (example == null) { |
||||
return; |
||||
} |
||||
|
||||
String parmPhrase1; |
||||
String parmPhrase1_th; |
||||
String parmPhrase2; |
||||
String parmPhrase2_th; |
||||
String parmPhrase3; |
||||
String parmPhrase3_th; |
||||
if (includeExamplePhrase) { |
||||
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} else { |
||||
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} |
||||
|
||||
StringBuilder sb = new StringBuilder(); |
||||
List<Criteria> oredCriteria = example.getOredCriteria(); |
||||
boolean firstCriteria = true; |
||||
for (int i = 0; i < oredCriteria.size(); i++) { |
||||
Criteria criteria = oredCriteria.get(i); |
||||
if (criteria.isValid()) { |
||||
if (firstCriteria) { |
||||
firstCriteria = false; |
||||
} else { |
||||
sb.append(" or "); |
||||
} |
||||
|
||||
sb.append('('); |
||||
List<Criterion> criterions = criteria.getAllCriteria(); |
||||
boolean firstCriterion = true; |
||||
for (int j = 0; j < criterions.size(); j++) { |
||||
Criterion criterion = criterions.get(j); |
||||
if (firstCriterion) { |
||||
firstCriterion = false; |
||||
} else { |
||||
sb.append(" and "); |
||||
} |
||||
|
||||
if (criterion.isNoValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
} else if (criterion.isSingleValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isBetweenValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isListValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
sb.append(" ("); |
||||
List<?> listItems = (List<?>) criterion.getValue(); |
||||
boolean comma = false; |
||||
for (int k = 0; k < listItems.size(); k++) { |
||||
if (comma) { |
||||
sb.append(", "); |
||||
} else { |
||||
comma = true; |
||||
} |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase3, i, j, k)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
|
||||
if (sb.length() > 0) { |
||||
sql.WHERE(sb.toString()); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,142 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.GoodsAutoTask; |
||||
import com.hfkj.entity.GoodsAutoTaskExample; |
||||
import java.util.List; |
||||
import org.apache.ibatis.annotations.Delete; |
||||
import org.apache.ibatis.annotations.DeleteProvider; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.InsertProvider; |
||||
import org.apache.ibatis.annotations.Options; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Result; |
||||
import org.apache.ibatis.annotations.Results; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.SelectProvider; |
||||
import org.apache.ibatis.annotations.Update; |
||||
import org.apache.ibatis.annotations.UpdateProvider; |
||||
import org.apache.ibatis.type.JdbcType; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
/** |
||||
* |
||||
* 代码由工具生成,请勿修改!!! |
||||
* 如果需要扩展请在其父类进行扩展 |
||||
* |
||||
**/ |
||||
@Repository |
||||
public interface GoodsAutoTaskMapper extends GoodsAutoTaskMapperExt { |
||||
@SelectProvider(type=GoodsAutoTaskSqlProvider.class, method="countByExample") |
||||
long countByExample(GoodsAutoTaskExample example); |
||||
|
||||
@DeleteProvider(type=GoodsAutoTaskSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(GoodsAutoTaskExample example); |
||||
|
||||
@Delete({ |
||||
"delete from goods_auto_task", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into goods_auto_task (`type`, task_title, ", |
||||
"listing_time, removal_time, ", |
||||
"inventory, `status`, ", |
||||
"create_time, update_time, ", |
||||
"create_user_id, create_user_name, ", |
||||
"update_user_id, update_user_name, ", |
||||
"ext_1, ext_2, ext_3)", |
||||
"values (#{type,jdbcType=INTEGER}, #{taskTitle,jdbcType=VARCHAR}, ", |
||||
"#{listingTime,jdbcType=TIMESTAMP}, #{removalTime,jdbcType=TIMESTAMP}, ", |
||||
"#{inventory,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, ", |
||||
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", |
||||
"#{createUserId,jdbcType=BIGINT}, #{createUserName,jdbcType=VARCHAR}, ", |
||||
"#{updateUserId,jdbcType=BIGINT}, #{updateUserName,jdbcType=VARCHAR}, ", |
||||
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(GoodsAutoTask record); |
||||
|
||||
@InsertProvider(type=GoodsAutoTaskSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(GoodsAutoTask record); |
||||
|
||||
@SelectProvider(type=GoodsAutoTaskSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="task_title", property="taskTitle", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="listing_time", property="listingTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="removal_time", property="removalTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="inventory", property="inventory", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="create_user_name", property="createUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="update_user_id", property="updateUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="update_user_name", property="updateUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<GoodsAutoTask> selectByExample(GoodsAutoTaskExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, `type`, task_title, listing_time, removal_time, inventory, `status`, create_time, ", |
||||
"update_time, create_user_id, create_user_name, update_user_id, update_user_name, ", |
||||
"ext_1, ext_2, ext_3", |
||||
"from goods_auto_task", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="task_title", property="taskTitle", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="listing_time", property="listingTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="removal_time", property="removalTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="inventory", property="inventory", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="create_user_name", property="createUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="update_user_id", property="updateUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="update_user_name", property="updateUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
GoodsAutoTask selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=GoodsAutoTaskSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") GoodsAutoTask record, @Param("example") GoodsAutoTaskExample example); |
||||
|
||||
@UpdateProvider(type=GoodsAutoTaskSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") GoodsAutoTask record, @Param("example") GoodsAutoTaskExample example); |
||||
|
||||
@UpdateProvider(type=GoodsAutoTaskSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(GoodsAutoTask record); |
||||
|
||||
@Update({ |
||||
"update goods_auto_task", |
||||
"set `type` = #{type,jdbcType=INTEGER},", |
||||
"task_title = #{taskTitle,jdbcType=VARCHAR},", |
||||
"listing_time = #{listingTime,jdbcType=TIMESTAMP},", |
||||
"removal_time = #{removalTime,jdbcType=TIMESTAMP},", |
||||
"inventory = #{inventory,jdbcType=INTEGER},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||
"create_user_id = #{createUserId,jdbcType=BIGINT},", |
||||
"create_user_name = #{createUserName,jdbcType=VARCHAR},", |
||||
"update_user_id = #{updateUserId,jdbcType=BIGINT},", |
||||
"update_user_name = #{updateUserName,jdbcType=VARCHAR},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(GoodsAutoTask record); |
||||
} |
||||
@ -0,0 +1,64 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.GoodsAutoTask; |
||||
import org.apache.ibatis.annotations.Result; |
||||
import org.apache.ibatis.annotations.Results; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.type.JdbcType; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface GoodsAutoTaskMapperExt { |
||||
|
||||
@Select("<script>" + |
||||
" SELECT * FROM goods_auto_task" + |
||||
" WHERE DATE(listing_time) = CURDATE() AND `status` = 1 and type = 1 ORDER BY listing_time DESC;" + |
||||
"</script>") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true), |
||||
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="task_title", property="taskTitle", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="listing_time", property="listingTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="removal_time", property="removalTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="inventory", property="inventory", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="create_user_name", property="createUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="update_user_id", property="updateUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="update_user_name", property="updateUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<GoodsAutoTask> listingList(); |
||||
|
||||
@Select("<script>" + |
||||
" SELECT * FROM goods_auto_task" + |
||||
" WHERE DATE(removal_time) = CURDATE() AND `status` = 1 and type = 2 ORDER BY removal_time DESC;" + |
||||
"</script>") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="task_title", property="taskTitle", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="listing_time", property="listingTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="removal_time", property="removalTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="inventory", property="inventory", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="create_user_name", property="createUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="update_user_id", property="updateUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="update_user_name", property="updateUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<GoodsAutoTask> removalList(); |
||||
|
||||
} |
||||
@ -0,0 +1,388 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.GoodsAutoTask; |
||||
import com.hfkj.entity.GoodsAutoTaskExample.Criteria; |
||||
import com.hfkj.entity.GoodsAutoTaskExample.Criterion; |
||||
import com.hfkj.entity.GoodsAutoTaskExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class GoodsAutoTaskSqlProvider { |
||||
|
||||
public String countByExample(GoodsAutoTaskExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("goods_auto_task"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(GoodsAutoTaskExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("goods_auto_task"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(GoodsAutoTask record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("goods_auto_task"); |
||||
|
||||
if (record.getType() != null) { |
||||
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getTaskTitle() != null) { |
||||
sql.VALUES("task_title", "#{taskTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getListingTime() != null) { |
||||
sql.VALUES("listing_time", "#{listingTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getRemovalTime() != null) { |
||||
sql.VALUES("removal_time", "#{removalTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getInventory() != null) { |
||||
sql.VALUES("inventory", "#{inventory,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateUserId() != null) { |
||||
sql.VALUES("create_user_id", "#{createUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCreateUserName() != null) { |
||||
sql.VALUES("create_user_name", "#{createUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserId() != null) { |
||||
sql.VALUES("update_user_id", "#{updateUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserName() != null) { |
||||
sql.VALUES("update_user_name", "#{updateUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String selectByExample(GoodsAutoTaskExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("`type`"); |
||||
sql.SELECT("task_title"); |
||||
sql.SELECT("listing_time"); |
||||
sql.SELECT("removal_time"); |
||||
sql.SELECT("inventory"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("create_user_id"); |
||||
sql.SELECT("create_user_name"); |
||||
sql.SELECT("update_user_id"); |
||||
sql.SELECT("update_user_name"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("goods_auto_task"); |
||||
applyWhere(sql, example, false); |
||||
|
||||
if (example != null && example.getOrderByClause() != null) { |
||||
sql.ORDER_BY(example.getOrderByClause()); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExampleSelective(Map<String, Object> parameter) { |
||||
GoodsAutoTask record = (GoodsAutoTask) parameter.get("record"); |
||||
GoodsAutoTaskExample example = (GoodsAutoTaskExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("goods_auto_task"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getType() != null) { |
||||
sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getTaskTitle() != null) { |
||||
sql.SET("task_title = #{record.taskTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getListingTime() != null) { |
||||
sql.SET("listing_time = #{record.listingTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getRemovalTime() != null) { |
||||
sql.SET("removal_time = #{record.removalTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getInventory() != null) { |
||||
sql.SET("inventory = #{record.inventory,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateUserId() != null) { |
||||
sql.SET("create_user_id = #{record.createUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCreateUserName() != null) { |
||||
sql.SET("create_user_name = #{record.createUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserId() != null) { |
||||
sql.SET("update_user_id = #{record.updateUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserName() != null) { |
||||
sql.SET("update_user_name = #{record.updateUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExample(Map<String, Object> parameter) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("goods_auto_task"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); |
||||
sql.SET("task_title = #{record.taskTitle,jdbcType=VARCHAR}"); |
||||
sql.SET("listing_time = #{record.listingTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("removal_time = #{record.removalTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("inventory = #{record.inventory,jdbcType=INTEGER}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("create_user_id = #{record.createUserId,jdbcType=BIGINT}"); |
||||
sql.SET("create_user_name = #{record.createUserName,jdbcType=VARCHAR}"); |
||||
sql.SET("update_user_id = #{record.updateUserId,jdbcType=BIGINT}"); |
||||
sql.SET("update_user_name = #{record.updateUserName,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
|
||||
GoodsAutoTaskExample example = (GoodsAutoTaskExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(GoodsAutoTask record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("goods_auto_task"); |
||||
|
||||
if (record.getType() != null) { |
||||
sql.SET("`type` = #{type,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getTaskTitle() != null) { |
||||
sql.SET("task_title = #{taskTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getListingTime() != null) { |
||||
sql.SET("listing_time = #{listingTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getRemovalTime() != null) { |
||||
sql.SET("removal_time = #{removalTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getInventory() != null) { |
||||
sql.SET("inventory = #{inventory,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateUserId() != null) { |
||||
sql.SET("create_user_id = #{createUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCreateUserName() != null) { |
||||
sql.SET("create_user_name = #{createUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserId() != null) { |
||||
sql.SET("update_user_id = #{updateUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getUpdateUserName() != null) { |
||||
sql.SET("update_user_name = #{updateUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
protected void applyWhere(SQL sql, GoodsAutoTaskExample example, boolean includeExamplePhrase) { |
||||
if (example == null) { |
||||
return; |
||||
} |
||||
|
||||
String parmPhrase1; |
||||
String parmPhrase1_th; |
||||
String parmPhrase2; |
||||
String parmPhrase2_th; |
||||
String parmPhrase3; |
||||
String parmPhrase3_th; |
||||
if (includeExamplePhrase) { |
||||
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} else { |
||||
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} |
||||
|
||||
StringBuilder sb = new StringBuilder(); |
||||
List<Criteria> oredCriteria = example.getOredCriteria(); |
||||
boolean firstCriteria = true; |
||||
for (int i = 0; i < oredCriteria.size(); i++) { |
||||
Criteria criteria = oredCriteria.get(i); |
||||
if (criteria.isValid()) { |
||||
if (firstCriteria) { |
||||
firstCriteria = false; |
||||
} else { |
||||
sb.append(" or "); |
||||
} |
||||
|
||||
sb.append('('); |
||||
List<Criterion> criterions = criteria.getAllCriteria(); |
||||
boolean firstCriterion = true; |
||||
for (int j = 0; j < criterions.size(); j++) { |
||||
Criterion criterion = criterions.get(j); |
||||
if (firstCriterion) { |
||||
firstCriterion = false; |
||||
} else { |
||||
sb.append(" and "); |
||||
} |
||||
|
||||
if (criterion.isNoValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
} else if (criterion.isSingleValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isBetweenValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isListValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
sb.append(" ("); |
||||
List<?> listItems = (List<?>) criterion.getValue(); |
||||
boolean comma = false; |
||||
for (int k = 0; k < listItems.size(); k++) { |
||||
if (comma) { |
||||
sb.append(", "); |
||||
} else { |
||||
comma = true; |
||||
} |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase3, i, j, k)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
|
||||
if (sb.length() > 0) { |
||||
sql.WHERE(sb.toString()); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,344 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* goods_auto_rel |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class GoodsAutoRel implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 类型:1 上架 2:下架 |
||||
*/ |
||||
private Integer type; |
||||
|
||||
/** |
||||
* 商品ID |
||||
*/ |
||||
private Long goodsId; |
||||
|
||||
/** |
||||
* 商品名称 |
||||
*/ |
||||
private String goodsName; |
||||
|
||||
/** |
||||
* 任务ID |
||||
*/ |
||||
private Long taskId; |
||||
|
||||
/** |
||||
* 任务标题 |
||||
*/ |
||||
private String taskTitle; |
||||
|
||||
/** |
||||
* 上架时间 |
||||
*/ |
||||
private Date listingTime; |
||||
|
||||
/** |
||||
* 下架时间 |
||||
*/ |
||||
private Date removalTime; |
||||
|
||||
/** |
||||
* 状态 1:待启动 0:删除 2:成功 3:失败 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String remak; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
/** |
||||
* 创建人ID |
||||
*/ |
||||
private Long createUserId; |
||||
|
||||
/** |
||||
* 创建人名称 |
||||
*/ |
||||
private String createUserName; |
||||
|
||||
/** |
||||
* 更新人ID |
||||
*/ |
||||
private Long updateUserId; |
||||
|
||||
/** |
||||
* 更新人名称 |
||||
*/ |
||||
private String updateUserName; |
||||
|
||||
private String ext1; |
||||
|
||||
private String ext2; |
||||
|
||||
private String ext3; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Integer getType() { |
||||
return type; |
||||
} |
||||
|
||||
public void setType(Integer type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
public Long getGoodsId() { |
||||
return goodsId; |
||||
} |
||||
|
||||
public void setGoodsId(Long goodsId) { |
||||
this.goodsId = goodsId; |
||||
} |
||||
|
||||
public String getGoodsName() { |
||||
return goodsName; |
||||
} |
||||
|
||||
public void setGoodsName(String goodsName) { |
||||
this.goodsName = goodsName; |
||||
} |
||||
|
||||
public Long getTaskId() { |
||||
return taskId; |
||||
} |
||||
|
||||
public void setTaskId(Long taskId) { |
||||
this.taskId = taskId; |
||||
} |
||||
|
||||
public String getTaskTitle() { |
||||
return taskTitle; |
||||
} |
||||
|
||||
public void setTaskTitle(String taskTitle) { |
||||
this.taskTitle = taskTitle; |
||||
} |
||||
|
||||
public Date getListingTime() { |
||||
return listingTime; |
||||
} |
||||
|
||||
public void setListingTime(Date listingTime) { |
||||
this.listingTime = listingTime; |
||||
} |
||||
|
||||
public Date getRemovalTime() { |
||||
return removalTime; |
||||
} |
||||
|
||||
public void setRemovalTime(Date removalTime) { |
||||
this.removalTime = removalTime; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public String getRemak() { |
||||
return remak; |
||||
} |
||||
|
||||
public void setRemak(String remak) { |
||||
this.remak = remak; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Date getUpdateTime() { |
||||
return updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(Date updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
public Long getCreateUserId() { |
||||
return createUserId; |
||||
} |
||||
|
||||
public void setCreateUserId(Long createUserId) { |
||||
this.createUserId = createUserId; |
||||
} |
||||
|
||||
public String getCreateUserName() { |
||||
return createUserName; |
||||
} |
||||
|
||||
public void setCreateUserName(String createUserName) { |
||||
this.createUserName = createUserName; |
||||
} |
||||
|
||||
public Long getUpdateUserId() { |
||||
return updateUserId; |
||||
} |
||||
|
||||
public void setUpdateUserId(Long updateUserId) { |
||||
this.updateUserId = updateUserId; |
||||
} |
||||
|
||||
public String getUpdateUserName() { |
||||
return updateUserName; |
||||
} |
||||
|
||||
public void setUpdateUserName(String updateUserName) { |
||||
this.updateUserName = updateUserName; |
||||
} |
||||
|
||||
public String getExt1() { |
||||
return ext1; |
||||
} |
||||
|
||||
public void setExt1(String ext1) { |
||||
this.ext1 = ext1; |
||||
} |
||||
|
||||
public String getExt2() { |
||||
return ext2; |
||||
} |
||||
|
||||
public void setExt2(String ext2) { |
||||
this.ext2 = ext2; |
||||
} |
||||
|
||||
public String getExt3() { |
||||
return ext3; |
||||
} |
||||
|
||||
public void setExt3(String ext3) { |
||||
this.ext3 = ext3; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object that) { |
||||
if (this == that) { |
||||
return true; |
||||
} |
||||
if (that == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != that.getClass()) { |
||||
return false; |
||||
} |
||||
GoodsAutoRel other = (GoodsAutoRel) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) |
||||
&& (this.getGoodsId() == null ? other.getGoodsId() == null : this.getGoodsId().equals(other.getGoodsId())) |
||||
&& (this.getGoodsName() == null ? other.getGoodsName() == null : this.getGoodsName().equals(other.getGoodsName())) |
||||
&& (this.getTaskId() == null ? other.getTaskId() == null : this.getTaskId().equals(other.getTaskId())) |
||||
&& (this.getTaskTitle() == null ? other.getTaskTitle() == null : this.getTaskTitle().equals(other.getTaskTitle())) |
||||
&& (this.getListingTime() == null ? other.getListingTime() == null : this.getListingTime().equals(other.getListingTime())) |
||||
&& (this.getRemovalTime() == null ? other.getRemovalTime() == null : this.getRemovalTime().equals(other.getRemovalTime())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getRemak() == null ? other.getRemak() == null : this.getRemak().equals(other.getRemak())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||
&& (this.getCreateUserId() == null ? other.getCreateUserId() == null : this.getCreateUserId().equals(other.getCreateUserId())) |
||||
&& (this.getCreateUserName() == null ? other.getCreateUserName() == null : this.getCreateUserName().equals(other.getCreateUserName())) |
||||
&& (this.getUpdateUserId() == null ? other.getUpdateUserId() == null : this.getUpdateUserId().equals(other.getUpdateUserId())) |
||||
&& (this.getUpdateUserName() == null ? other.getUpdateUserName() == null : this.getUpdateUserName().equals(other.getUpdateUserName())) |
||||
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||
result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); |
||||
result = prime * result + ((getGoodsId() == null) ? 0 : getGoodsId().hashCode()); |
||||
result = prime * result + ((getGoodsName() == null) ? 0 : getGoodsName().hashCode()); |
||||
result = prime * result + ((getTaskId() == null) ? 0 : getTaskId().hashCode()); |
||||
result = prime * result + ((getTaskTitle() == null) ? 0 : getTaskTitle().hashCode()); |
||||
result = prime * result + ((getListingTime() == null) ? 0 : getListingTime().hashCode()); |
||||
result = prime * result + ((getRemovalTime() == null) ? 0 : getRemovalTime().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getRemak() == null) ? 0 : getRemak().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); |
||||
result = prime * result + ((getCreateUserId() == null) ? 0 : getCreateUserId().hashCode()); |
||||
result = prime * result + ((getCreateUserName() == null) ? 0 : getCreateUserName().hashCode()); |
||||
result = prime * result + ((getUpdateUserId() == null) ? 0 : getUpdateUserId().hashCode()); |
||||
result = prime * result + ((getUpdateUserName() == null) ? 0 : getUpdateUserName().hashCode()); |
||||
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
StringBuilder sb = new StringBuilder(); |
||||
sb.append(getClass().getSimpleName()); |
||||
sb.append(" ["); |
||||
sb.append("Hash = ").append(hashCode()); |
||||
sb.append(", id=").append(id); |
||||
sb.append(", type=").append(type); |
||||
sb.append(", goodsId=").append(goodsId); |
||||
sb.append(", goodsName=").append(goodsName); |
||||
sb.append(", taskId=").append(taskId); |
||||
sb.append(", taskTitle=").append(taskTitle); |
||||
sb.append(", listingTime=").append(listingTime); |
||||
sb.append(", removalTime=").append(removalTime); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", remak=").append(remak); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", updateTime=").append(updateTime); |
||||
sb.append(", createUserId=").append(createUserId); |
||||
sb.append(", createUserName=").append(createUserName); |
||||
sb.append(", updateUserId=").append(updateUserId); |
||||
sb.append(", updateUserName=").append(updateUserName); |
||||
sb.append(", ext1=").append(ext1); |
||||
sb.append(", ext2=").append(ext2); |
||||
sb.append(", ext3=").append(ext3); |
||||
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||
sb.append("]"); |
||||
return sb.toString(); |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,296 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* goods_auto_task |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class GoodsAutoTask implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 类型:1 上架 2:下架 |
||||
*/ |
||||
private Integer type; |
||||
|
||||
/** |
||||
* 任务标题 |
||||
*/ |
||||
private String taskTitle; |
||||
|
||||
/** |
||||
* 上架时间 |
||||
*/ |
||||
private Date listingTime; |
||||
|
||||
/** |
||||
* 下架时间 |
||||
*/ |
||||
private Date removalTime; |
||||
|
||||
/** |
||||
* 库存 |
||||
*/ |
||||
private Integer inventory; |
||||
|
||||
/** |
||||
* 状态:1:启动 2 成功 3:失败 0:删除 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
/** |
||||
* 创建人ID |
||||
*/ |
||||
private Long createUserId; |
||||
|
||||
/** |
||||
* 创建人名称 |
||||
*/ |
||||
private String createUserName; |
||||
|
||||
/** |
||||
* 更新人ID |
||||
*/ |
||||
private Long updateUserId; |
||||
|
||||
/** |
||||
* 更新人名称 |
||||
*/ |
||||
private String updateUserName; |
||||
|
||||
private String ext1; |
||||
|
||||
private String ext2; |
||||
|
||||
private String ext3; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Integer getType() { |
||||
return type; |
||||
} |
||||
|
||||
public void setType(Integer type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
public String getTaskTitle() { |
||||
return taskTitle; |
||||
} |
||||
|
||||
public void setTaskTitle(String taskTitle) { |
||||
this.taskTitle = taskTitle; |
||||
} |
||||
|
||||
public Date getListingTime() { |
||||
return listingTime; |
||||
} |
||||
|
||||
public void setListingTime(Date listingTime) { |
||||
this.listingTime = listingTime; |
||||
} |
||||
|
||||
public Date getRemovalTime() { |
||||
return removalTime; |
||||
} |
||||
|
||||
public void setRemovalTime(Date removalTime) { |
||||
this.removalTime = removalTime; |
||||
} |
||||
|
||||
public Integer getInventory() { |
||||
return inventory; |
||||
} |
||||
|
||||
public void setInventory(Integer inventory) { |
||||
this.inventory = inventory; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Date getUpdateTime() { |
||||
return updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(Date updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
public Long getCreateUserId() { |
||||
return createUserId; |
||||
} |
||||
|
||||
public void setCreateUserId(Long createUserId) { |
||||
this.createUserId = createUserId; |
||||
} |
||||
|
||||
public String getCreateUserName() { |
||||
return createUserName; |
||||
} |
||||
|
||||
public void setCreateUserName(String createUserName) { |
||||
this.createUserName = createUserName; |
||||
} |
||||
|
||||
public Long getUpdateUserId() { |
||||
return updateUserId; |
||||
} |
||||
|
||||
public void setUpdateUserId(Long updateUserId) { |
||||
this.updateUserId = updateUserId; |
||||
} |
||||
|
||||
public String getUpdateUserName() { |
||||
return updateUserName; |
||||
} |
||||
|
||||
public void setUpdateUserName(String updateUserName) { |
||||
this.updateUserName = updateUserName; |
||||
} |
||||
|
||||
public String getExt1() { |
||||
return ext1; |
||||
} |
||||
|
||||
public void setExt1(String ext1) { |
||||
this.ext1 = ext1; |
||||
} |
||||
|
||||
public String getExt2() { |
||||
return ext2; |
||||
} |
||||
|
||||
public void setExt2(String ext2) { |
||||
this.ext2 = ext2; |
||||
} |
||||
|
||||
public String getExt3() { |
||||
return ext3; |
||||
} |
||||
|
||||
public void setExt3(String ext3) { |
||||
this.ext3 = ext3; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object that) { |
||||
if (this == that) { |
||||
return true; |
||||
} |
||||
if (that == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != that.getClass()) { |
||||
return false; |
||||
} |
||||
GoodsAutoTask other = (GoodsAutoTask) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) |
||||
&& (this.getTaskTitle() == null ? other.getTaskTitle() == null : this.getTaskTitle().equals(other.getTaskTitle())) |
||||
&& (this.getListingTime() == null ? other.getListingTime() == null : this.getListingTime().equals(other.getListingTime())) |
||||
&& (this.getRemovalTime() == null ? other.getRemovalTime() == null : this.getRemovalTime().equals(other.getRemovalTime())) |
||||
&& (this.getInventory() == null ? other.getInventory() == null : this.getInventory().equals(other.getInventory())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||
&& (this.getCreateUserId() == null ? other.getCreateUserId() == null : this.getCreateUserId().equals(other.getCreateUserId())) |
||||
&& (this.getCreateUserName() == null ? other.getCreateUserName() == null : this.getCreateUserName().equals(other.getCreateUserName())) |
||||
&& (this.getUpdateUserId() == null ? other.getUpdateUserId() == null : this.getUpdateUserId().equals(other.getUpdateUserId())) |
||||
&& (this.getUpdateUserName() == null ? other.getUpdateUserName() == null : this.getUpdateUserName().equals(other.getUpdateUserName())) |
||||
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||
result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); |
||||
result = prime * result + ((getTaskTitle() == null) ? 0 : getTaskTitle().hashCode()); |
||||
result = prime * result + ((getListingTime() == null) ? 0 : getListingTime().hashCode()); |
||||
result = prime * result + ((getRemovalTime() == null) ? 0 : getRemovalTime().hashCode()); |
||||
result = prime * result + ((getInventory() == null) ? 0 : getInventory().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); |
||||
result = prime * result + ((getCreateUserId() == null) ? 0 : getCreateUserId().hashCode()); |
||||
result = prime * result + ((getCreateUserName() == null) ? 0 : getCreateUserName().hashCode()); |
||||
result = prime * result + ((getUpdateUserId() == null) ? 0 : getUpdateUserId().hashCode()); |
||||
result = prime * result + ((getUpdateUserName() == null) ? 0 : getUpdateUserName().hashCode()); |
||||
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
StringBuilder sb = new StringBuilder(); |
||||
sb.append(getClass().getSimpleName()); |
||||
sb.append(" ["); |
||||
sb.append("Hash = ").append(hashCode()); |
||||
sb.append(", id=").append(id); |
||||
sb.append(", type=").append(type); |
||||
sb.append(", taskTitle=").append(taskTitle); |
||||
sb.append(", listingTime=").append(listingTime); |
||||
sb.append(", removalTime=").append(removalTime); |
||||
sb.append(", inventory=").append(inventory); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", updateTime=").append(updateTime); |
||||
sb.append(", createUserId=").append(createUserId); |
||||
sb.append(", createUserName=").append(createUserName); |
||||
sb.append(", updateUserId=").append(updateUserId); |
||||
sb.append(", updateUserName=").append(updateUserName); |
||||
sb.append(", ext1=").append(ext1); |
||||
sb.append(", ext2=").append(ext2); |
||||
sb.append(", ext3=").append(ext3); |
||||
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||
sb.append("]"); |
||||
return sb.toString(); |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,77 @@ |
||||
package com.hfkj.service.goods; |
||||
|
||||
import com.hfkj.entity.GoodsAutoRel; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface GoodsAutoRelService { |
||||
|
||||
/** |
||||
* @MethodName create |
||||
* @Description: 创建 |
||||
* @param goodsAutoRel |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:40 |
||||
*/ |
||||
void create(GoodsAutoRel goodsAutoRel); |
||||
|
||||
/** |
||||
* @MethodName update |
||||
* @Description: 更新 |
||||
* @param goodsAutoRel |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:41 |
||||
*/ |
||||
void update(GoodsAutoRel goodsAutoRel); |
||||
|
||||
/** |
||||
* @MethodName delete |
||||
* @Description: 删除 |
||||
* @param id |
||||
* @param fullDelete |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:41 |
||||
*/ |
||||
void delete(Long id , Boolean fullDelete); |
||||
|
||||
/** |
||||
* @MethodName queryDetail |
||||
* @Description: 查询详情 |
||||
* @param id |
||||
* @return: com.hfkj.entity.GoodsAutoRel |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:41 |
||||
*/ |
||||
GoodsAutoRel queryDetail(Long id); |
||||
|
||||
/** |
||||
* @MethodName queryDetailByMap |
||||
* @Description: 根据map查询详情 |
||||
* @param map |
||||
* @return: com.hfkj.entity.GoodsAutoRel |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:41 |
||||
*/ |
||||
GoodsAutoRel queryDetailByMap(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @MethodName goodsTaskRel |
||||
* @Description: 商品任务关联 |
||||
* @param taskId |
||||
* @param goodsIds |
||||
* @param createUserId |
||||
* @param createUserName |
||||
*/ |
||||
void goodsTaskRel(Long taskId , String goodsIds , Long createUserId , String createUserName); |
||||
|
||||
/** |
||||
* @MethodName getList |
||||
* @Description: 查询列表 |
||||
* @param map |
||||
* @return: java.util.List<com.hfkj.entity.GoodsAutoRel> |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:41 |
||||
*/ |
||||
List<GoodsAutoRel> getList(Map<String , Object> map); |
||||
} |
||||
@ -0,0 +1,83 @@ |
||||
package com.hfkj.service.goods; |
||||
|
||||
import com.hfkj.entity.GoodsAutoTask; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface GoodsAutoTaskService { |
||||
|
||||
/** |
||||
* @MethodName create |
||||
* @Description: 创建 |
||||
* @param goodsAutoTask |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:40 |
||||
*/ |
||||
void create(GoodsAutoTask goodsAutoTask) throws Exception; |
||||
|
||||
/** |
||||
* @MethodName update |
||||
* @Description: 更新 |
||||
* @param goodsAutoTask |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:41 |
||||
*/ |
||||
void update(GoodsAutoTask goodsAutoTask); |
||||
|
||||
/** |
||||
* @MethodName delete |
||||
* @Description: 删除 |
||||
* @param id |
||||
* @param fullDelete |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:41 |
||||
*/ |
||||
void delete(Long id , Boolean fullDelete); |
||||
|
||||
/** |
||||
* @MethodName queryDetail |
||||
* @Description: 查询详情 |
||||
* @param id |
||||
* @return: com.hfkj.entity.GoodsAutoTask |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:41 |
||||
*/ |
||||
GoodsAutoTask queryDetail(Long id); |
||||
|
||||
/** |
||||
* @MethodName queryDetailByMap |
||||
* @Description: 根据map查询详情 |
||||
* @param map |
||||
* @return: com.hfkj.entity.GoodsAutoTask |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:41 |
||||
*/ |
||||
GoodsAutoTask queryDetailByMap(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @MethodName getList |
||||
* @Description: 查询列表 |
||||
* @param map |
||||
* @return: java.util.List<com.hfkj.entity.GoodsAutoTask> |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:41 |
||||
*/ |
||||
List<GoodsAutoTask> getList(Map<String , Object> map); |
||||
|
||||
|
||||
List<GoodsAutoTask> getListingTimeList(); |
||||
|
||||
List<GoodsAutoTask> getRemovalTimeList(); |
||||
|
||||
/** |
||||
* @MethodName startTask |
||||
* @Description: 启动任务 |
||||
* @param goodsAutoTask |
||||
* @throws Exception |
||||
* @Author: Sum1Dream |
||||
* @Date: 2025/7/1 下午4:41 |
||||
*/ |
||||
void startListingTask(GoodsAutoTask goodsAutoTask , Integer taskType); |
||||
|
||||
} |
||||
@ -0,0 +1,204 @@ |
||||
package com.hfkj.service.goods.impl; |
||||
|
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.dao.GoodsAutoRelMapper; |
||||
import com.hfkj.entity.GoodsAutoRel; |
||||
import com.hfkj.entity.GoodsAutoRelExample; |
||||
import com.hfkj.entity.GoodsAutoTask; |
||||
import com.hfkj.entity.GoodsMsg; |
||||
import com.hfkj.service.goods.GoodsAutoRelService; |
||||
import com.hfkj.service.goods.GoodsAutoTaskService; |
||||
import com.hfkj.service.goods.GoodsMsgService; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Propagation; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Collections; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("goodsAutoRelService") |
||||
public class GoodsAutoRelServiceImpl implements GoodsAutoRelService { |
||||
|
||||
@Resource |
||||
private GoodsAutoRelMapper goodsAutoRelMapper; |
||||
|
||||
@Resource |
||||
private GoodsMsgService goodsMsgService; |
||||
|
||||
@Resource |
||||
private GoodsAutoTaskService goodsAutoTaskService; |
||||
|
||||
@Override |
||||
public void create(GoodsAutoRel goodsAutoRel) { |
||||
goodsAutoRelMapper.insert(goodsAutoRel); |
||||
} |
||||
|
||||
@Override |
||||
public void update(GoodsAutoRel goodsAutoRel) { |
||||
goodsAutoRelMapper.updateByPrimaryKey(goodsAutoRel); |
||||
} |
||||
|
||||
@Override |
||||
public void delete(Long id, Boolean fullDelete) { |
||||
if (fullDelete) { |
||||
goodsAutoRelMapper.deleteByPrimaryKey(id); |
||||
} else { |
||||
GoodsAutoRel goodsAutoRel = queryDetail(id); |
||||
goodsAutoRel.setStatus(0); |
||||
goodsAutoRel.setUpdateTime(new Date()); |
||||
update(goodsAutoRel); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public GoodsAutoRel queryDetail(Long id) { |
||||
return goodsAutoRelMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
|
||||
|
||||
@Override |
||||
public GoodsAutoRel queryDetailByMap(Map<String, Object> map) { |
||||
GoodsAutoRelExample example = new GoodsAutoRelExample(); |
||||
GoodsAutoRelExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(map, "goodsId") != null) { |
||||
criteria.andGoodsIdEqualTo(MapUtils.getLong(map, "goodsId")); |
||||
} |
||||
if (MapUtils.getInteger(map, "type") != null) { |
||||
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type")); |
||||
} |
||||
if (StringUtils.isNotBlank(MapUtils.getString(map, "taskTitle"))) { |
||||
criteria.andTaskTitleLike("%"+MapUtils.getString(map, "taskTitle")+"%"); |
||||
} |
||||
if (StringUtils.isNotBlank(MapUtils.getString(map, "goodsName"))) { |
||||
criteria.andGoodsNameLike("%"+MapUtils.getString(map, "goodsName")+"%"); |
||||
} |
||||
if (MapUtils.getLong(map, "listingTime") != null) { |
||||
criteria.andListingTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "listingTime"))); |
||||
} |
||||
if (MapUtils.getLong(map, "removalTime") != null) { |
||||
criteria.andRemovalTimeLessThanOrEqualTo(new Date(MapUtils.getLong(map, "removalTime"))); |
||||
} |
||||
if (MapUtils.getLong(map, "taskId") != null) { |
||||
criteria.andTaskIdEqualTo(MapUtils.getLong(map, "taskId")); |
||||
} |
||||
if (MapUtils.getInteger(map, "status") != null) { |
||||
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||
}else { |
||||
criteria.andStatusNotEqualTo(0); |
||||
} |
||||
if (MapUtils.getLong(map , "id") != null) { |
||||
criteria.andIdEqualTo(MapUtils.getLong(map , "id")); |
||||
} |
||||
example.setOrderByClause("create_time desc"); |
||||
List<GoodsAutoRel> list = goodsAutoRelMapper.selectByExample(example); |
||||
|
||||
return list.isEmpty() ? null : list.get(0); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
@Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class}) |
||||
public void goodsTaskRel(Long taskId, String goodsIds , Long createUserId , String createUserName) { |
||||
|
||||
// 根据任务ID查询任务详情
|
||||
GoodsAutoTask goodsAutoTask = goodsAutoTaskService.queryDetail(taskId); |
||||
if (goodsAutoTask == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "任务不存在!"); |
||||
} |
||||
|
||||
// 将传入的商品ID字符串按逗号分割成数组
|
||||
String [] goodsIdArray = goodsIds.split(","); |
||||
|
||||
// 检查商品ID数组是否为空
|
||||
if (goodsIdArray.length == 0) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商品为空!"); |
||||
} |
||||
|
||||
|
||||
// 遍历商品ID数组
|
||||
for (String goodsId : goodsIdArray) { |
||||
|
||||
// 根据商品ID查询商品信息
|
||||
GoodsMsg goodsMsg = goodsMsgService.queryDetail(Long.valueOf(goodsId)); |
||||
|
||||
// 检查商品是否存在
|
||||
if (goodsMsg == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商品不存在!"); |
||||
} |
||||
|
||||
// 创建商品与任务的关联实体对象
|
||||
GoodsAutoRel goodsAutoRel = new GoodsAutoRel(); |
||||
goodsAutoRel.setType(goodsAutoTask.getType()); |
||||
// 设置商品ID
|
||||
goodsAutoRel.setGoodsId(Long.valueOf(goodsId)); |
||||
// 设置商品名称
|
||||
goodsAutoRel.setGoodsName(goodsMsg.getTitle()); |
||||
// 设置任务ID
|
||||
goodsAutoRel.setTaskId(taskId); |
||||
// 设置任务标题
|
||||
goodsAutoRel.setTaskTitle(goodsAutoTask.getTaskTitle()); |
||||
// 设置上架时间
|
||||
goodsAutoRel.setListingTime(goodsAutoTask.getListingTime()); |
||||
// 设置下架时间
|
||||
goodsAutoRel.setRemovalTime(goodsAutoTask.getRemovalTime()); |
||||
// 设置状态为1(正常状态)
|
||||
goodsAutoRel.setStatus(1); |
||||
// 设置创建时间
|
||||
goodsAutoRel.setCreateTime(new Date()); |
||||
// 设置创建用户ID
|
||||
goodsAutoRel.setCreateUserId(createUserId); |
||||
// 设置创建用户名称
|
||||
goodsAutoRel.setCreateUserName(createUserName); |
||||
// 保存商品与任务的关联关系
|
||||
create(goodsAutoRel); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public List<GoodsAutoRel> getList(Map<String, Object> map) { |
||||
|
||||
GoodsAutoRelExample example = new GoodsAutoRelExample(); |
||||
GoodsAutoRelExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(map, "goodsId") != null) { |
||||
criteria.andGoodsIdEqualTo(MapUtils.getLong(map, "goodsId")); |
||||
} |
||||
if (MapUtils.getInteger(map, "type") != null) { |
||||
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type")); |
||||
} |
||||
if (StringUtils.isNotBlank(MapUtils.getString(map, "taskTitle"))) { |
||||
criteria.andTaskTitleLike("%"+MapUtils.getString(map, "taskTitle")+"%"); |
||||
} |
||||
if (StringUtils.isNotBlank(MapUtils.getString(map, "goodsName"))) { |
||||
criteria.andGoodsNameLike("%"+MapUtils.getString(map, "goodsName")+"%"); |
||||
} |
||||
if (MapUtils.getLong(map, "listingTime") != null) { |
||||
criteria.andListingTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "listingTime"))); |
||||
} |
||||
if (MapUtils.getLong(map, "removalTime") != null) { |
||||
criteria.andRemovalTimeLessThanOrEqualTo(new Date(MapUtils.getLong(map, "removalTime"))); |
||||
} |
||||
if (MapUtils.getLong(map, "taskId") != null) { |
||||
criteria.andTaskIdEqualTo(MapUtils.getLong(map, "taskId")); |
||||
} |
||||
if (MapUtils.getInteger(map, "status") != null) { |
||||
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||
}else { |
||||
criteria.andStatusNotEqualTo(0); |
||||
} |
||||
if (MapUtils.getLong(map , "id") != null) { |
||||
criteria.andIdEqualTo(MapUtils.getLong(map , "id")); |
||||
} |
||||
example.setOrderByClause("create_time desc"); |
||||
return goodsAutoRelMapper.selectByExample(example); |
||||
} |
||||
} |
||||
@ -0,0 +1,225 @@ |
||||
package com.hfkj.service.goods.impl; |
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaGetLiveInfo; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.dao.GoodsAutoTaskMapper; |
||||
import com.hfkj.entity.*; |
||||
import com.hfkj.service.goods.GoodsAutoRelService; |
||||
import com.hfkj.service.goods.GoodsAutoTaskService; |
||||
import com.hfkj.service.goods.GoodsMsgService; |
||||
import com.hfkj.service.goods.GoodsSpecsService; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.*; |
||||
|
||||
@Service("goodsAutoTaskService") |
||||
public class GoodsAutoTaskServiceImpl implements GoodsAutoTaskService { |
||||
|
||||
@Resource |
||||
private GoodsAutoTaskMapper goodsAutoTaskMapper; |
||||
|
||||
@Resource |
||||
private GoodsAutoRelService goodsAutoRelService; |
||||
|
||||
@Resource |
||||
private GoodsMsgService goodsMsgService; |
||||
|
||||
@Resource |
||||
private GoodsSpecsService goodsSpecsService; |
||||
|
||||
@Override |
||||
public void create(GoodsAutoTask goodsAutoTask) throws Exception { |
||||
goodsAutoTaskMapper.insert(goodsAutoTask); |
||||
} |
||||
|
||||
@Override |
||||
public void update(GoodsAutoTask goodsAutoTask) { |
||||
goodsAutoTaskMapper.updateByPrimaryKey(goodsAutoTask); |
||||
} |
||||
|
||||
@Override |
||||
public void delete(Long id, Boolean fullDelete) { |
||||
if (fullDelete) { |
||||
goodsAutoTaskMapper.deleteByPrimaryKey(id); |
||||
} else { |
||||
GoodsAutoTask goodsAutoTask = queryDetail(id); |
||||
goodsAutoTask.setStatus(0); |
||||
goodsAutoTask.setUpdateTime(new Date()); |
||||
update(goodsAutoTask); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public GoodsAutoTask queryDetail(Long id) { |
||||
return goodsAutoTaskMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public GoodsAutoTask queryDetailByMap(Map<String, Object> map) { |
||||
GoodsAutoTaskExample example = new GoodsAutoTaskExample(); |
||||
GoodsAutoTaskExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(map, "listingTime") != null) { |
||||
criteria.andListingTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "listingTime"))); |
||||
} |
||||
if (MapUtils.getLong(map, "removalTime") != null) { |
||||
criteria.andRemovalTimeLessThanOrEqualTo(new Date(MapUtils.getLong(map, "removalTime"))); |
||||
} |
||||
if (MapUtils.getInteger(map, "type") != null) { |
||||
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type")); |
||||
} |
||||
if (StringUtils.isNotBlank(MapUtils.getString(map, "taskTitle"))) { |
||||
criteria.andTaskTitleLike("%"+MapUtils.getString(map, "taskTitle")+"%"); |
||||
} |
||||
if (MapUtils.getInteger(map, "status") != null) { |
||||
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||
}else { |
||||
criteria.andStatusNotEqualTo(0); |
||||
} |
||||
if (MapUtils.getLong(map , "id") != null) { |
||||
criteria.andIdEqualTo(MapUtils.getLong(map , "id")); |
||||
} |
||||
example.setOrderByClause("create_time desc"); |
||||
List<GoodsAutoTask> list = goodsAutoTaskMapper.selectByExample(example); |
||||
|
||||
return list.isEmpty() ? null : list.get(0); |
||||
} |
||||
|
||||
@Override |
||||
public List<GoodsAutoTask> getList(Map<String, Object> map) { |
||||
|
||||
GoodsAutoTaskExample example = new GoodsAutoTaskExample(); |
||||
GoodsAutoTaskExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(map, "listingTime") != null) { |
||||
criteria.andListingTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "listingTime"))); |
||||
} |
||||
if (MapUtils.getInteger(map, "type") != null) { |
||||
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type")); |
||||
} |
||||
if (StringUtils.isNotBlank(MapUtils.getString(map, "taskTitle"))) { |
||||
criteria.andTaskTitleLike("%"+MapUtils.getString(map, "taskTitle")+"%"); |
||||
} |
||||
if (MapUtils.getLong(map, "removalTime") != null) { |
||||
criteria.andRemovalTimeLessThanOrEqualTo(new Date(MapUtils.getLong(map, "removalTime"))); |
||||
} |
||||
if (MapUtils.getInteger(map, "status") != null) { |
||||
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||
}else { |
||||
criteria.andStatusNotEqualTo(0); |
||||
} |
||||
if (MapUtils.getLong(map , "id") != null) { |
||||
criteria.andIdEqualTo(MapUtils.getLong(map , "id")); |
||||
} |
||||
example.setOrderByClause("create_time desc"); |
||||
|
||||
return goodsAutoTaskMapper.selectByExample(example); |
||||
} |
||||
|
||||
@Override |
||||
public List<GoodsAutoTask> getListingTimeList() { |
||||
return goodsAutoTaskMapper.listingList(); |
||||
} |
||||
|
||||
@Override |
||||
public List<GoodsAutoTask> getRemovalTimeList() { |
||||
return goodsAutoTaskMapper.removalList(); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional |
||||
public void startListingTask(GoodsAutoTask goodsAutoTask , Integer taskType) { |
||||
|
||||
try { |
||||
// 创建一个HashMap对象,用于存储任务ID
|
||||
Map<String , Object> map = new HashMap<>(); |
||||
// 向map中添加任务ID
|
||||
map.put("taskId" , goodsAutoTask.getId()); |
||||
// 根据任务ID查询商品自动关联关系列表
|
||||
List<GoodsAutoRel> goodsAutoRel = goodsAutoRelService.getList(map); |
||||
|
||||
// 如果商品自动关联关系列表不为空
|
||||
if (!goodsAutoRel.isEmpty()) { |
||||
// 遍历商品自动关联关系列表
|
||||
for (GoodsAutoRel rel : goodsAutoRel) { |
||||
try { |
||||
// 根据商品ID查询商品详情
|
||||
GoodsMsg goodsMsg = goodsMsgService.queryDetail(rel.getGoodsId()); |
||||
// 如果商品详情为空,抛出异常
|
||||
if (goodsMsg == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商品不存在!"); |
||||
} |
||||
|
||||
// 创建规格查询条件map
|
||||
Map<String , Object> specsMap = new HashMap<>(); |
||||
// 向map中添加商品ID
|
||||
specsMap.put("goodsId" , goodsMsg.getId()); |
||||
|
||||
// 判断是上架操作还是下架操作
|
||||
if (taskType == 1) { |
||||
// 判断商品上架时间是否已到(将时间戳转换为秒进行比较)
|
||||
if (rel.getListingTime().getTime() / 1000 <= System.currentTimeMillis() / 1000) { |
||||
// 上架操作,更新商品状态为上架
|
||||
// 根据商品ID查询规格列表
|
||||
List<GoodsSpecs> specs = goodsSpecsService.getList(specsMap); |
||||
// 如果规格列表为空,抛出异常
|
||||
if (specs.isEmpty()) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商品规格不存在!"); |
||||
} |
||||
// 遍历规格列表,更新库存和更新时间
|
||||
for (GoodsSpecs spec : specs) { |
||||
spec.setStock(goodsAutoTask.getInventory()); // 设置商品规格的库存数量
|
||||
spec.setUpdateTime(new Date()); // 设置商品规格的更新时间
|
||||
goodsSpecsService.update(spec); // 更新商品规格信息
|
||||
} |
||||
// 更新商品状态和更新时间
|
||||
goodsMsg.setStatus(1); // 设置商品状态为已上架
|
||||
} |
||||
|
||||
} else { |
||||
|
||||
// 检查商品是否应该被下架
|
||||
// 比较商品的下架时间和当前时间(秒级)
|
||||
if (rel.getRemovalTime().getTime() / 1000 <= System.currentTimeMillis() / 1000) { |
||||
// 下架操作,更新商品状态为下架
|
||||
goodsMsg.setStatus(2); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
goodsMsg.setUpdateTime(new Date()); |
||||
goodsMsgService.update(goodsMsg); |
||||
|
||||
// 更新关联关系状态、备注和更新时间
|
||||
rel.setStatus(2); |
||||
rel.setRemak("成功"); |
||||
rel.setUpdateTime(new Date()); |
||||
goodsAutoRelService.update(rel); |
||||
} catch (Exception e) { |
||||
// 处理异常,更新关联关系状态、异常信息和更新时间
|
||||
rel.setStatus(3); |
||||
rel.setUpdateTime(new Date()); |
||||
rel.setRemak(e.getMessage()); |
||||
goodsAutoRelService.update(rel); |
||||
} |
||||
} |
||||
} |
||||
// 更新任务状态和更新时间
|
||||
goodsAutoTask.setStatus(2); |
||||
goodsAutoTask.setUpdateTime(new Date()); |
||||
update(goodsAutoTask); |
||||
} catch (Exception e) { |
||||
// 处理异常,更新任务状态和更新时间
|
||||
goodsAutoTask.setStatus(3); |
||||
goodsAutoTask.setUpdateTime(new Date()); |
||||
update(goodsAutoTask); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue