Commit 0c051ab4 by 周海峰

菜谱线路改为查询

parent d4dde8fe
......@@ -185,4 +185,12 @@ public class PlatformRecipesController {
Pagination pagination = new Pagination(page.getList(),new Long(page.getTotal()),pageSize,pageIndex);
return ResultJson.ok(pagination);
}
/**
* 查询所有线路
*/
@GetMapping("/lineList")
public ResultJson lineList(){
return ResultJson.ok(platformRecipesService.selectLine());
}
}
......@@ -99,4 +99,9 @@ public interface PlatformRecipesMapper {
int updateStatusByPrimaryKey(PlatformRecipes record);
PlatformRecipes loadByDateAndLine(Map params);
/**
* 查询所有线路
*/
List<PlatformRecipes> selectLine();
}
\ No newline at end of file
......@@ -2,31 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.metro.auth.platform.mapper.PlatformRecipesMapper">
<resultMap id="BaseResultMap" type="com.metro.auth.platform.domain.auth.PlatformRecipes">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="datetime" jdbcType="VARCHAR" property="datetime" />
<result column="weekday" jdbcType="VARCHAR" property="weekday" />
<result column="memo" jdbcType="VARCHAR" property="memo" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="am_zs" jdbcType="VARCHAR" property="am_zs" />
<result column="am_fs" jdbcType="VARCHAR" property="am_fs" />
<result column="am_qt" jdbcType="VARCHAR" property="am_qt" />
<result column="pm_zs" jdbcType="VARCHAR" property="pm_zs" />
<result column="pm_fs" jdbcType="VARCHAR" property="pm_fs" />
<result column="pm_bc" jdbcType="VARCHAR" property="pm_bc" />
<result column="pm_qt" jdbcType="VARCHAR" property="pm_qt" />
<result column="soup" jdbcType="VARCHAR" property="soup" />
<result column="line" jdbcType="VARCHAR" property="line" />
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="datetime" jdbcType="VARCHAR" property="datetime"/>
<result column="weekday" jdbcType="VARCHAR" property="weekday"/>
<result column="memo" jdbcType="VARCHAR" property="memo"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="am_zs" jdbcType="VARCHAR" property="am_zs"/>
<result column="am_fs" jdbcType="VARCHAR" property="am_fs"/>
<result column="am_qt" jdbcType="VARCHAR" property="am_qt"/>
<result column="pm_zs" jdbcType="VARCHAR" property="pm_zs"/>
<result column="pm_fs" jdbcType="VARCHAR" property="pm_fs"/>
<result column="pm_bc" jdbcType="VARCHAR" property="pm_bc"/>
<result column="pm_qt" jdbcType="VARCHAR" property="pm_qt"/>
<result column="soup" jdbcType="VARCHAR" property="soup"/>
<result column="line" jdbcType="VARCHAR" property="line"/>
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
......@@ -44,7 +37,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -55,11 +49,8 @@
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
......@@ -77,7 +68,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -88,65 +80,52 @@
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, title, datetime, weekday, memo, status,am_zs,am_fs,am_qt,pm_zs,pm_fs,pm_qt,pm_bc,soup,line
</sql>
<select id="selectByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformRecipesExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<select id="selectByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformRecipesExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from platform_recipes
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
select
<include refid="Base_Column_List"/>
from platform_recipes
where id = #{id,jdbcType=VARCHAR}
</select>
<select id="loadByDateAndLine" resultMap="BaseResultMap" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select * from platform_recipes where datetime = #{datetime} and line = #{line} limit 1
<select id="loadByDateAndLine" resultMap="BaseResultMap" parameterType="map">
select * from platform_recipes where datetime = #{datetime} and line = #{line} limit 1
</select>
<!-- 查询所有线路-->
<select id="selectLine" resultMap="BaseResultMap">
select line from platform_recipes group by line
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from platform_recipes
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformRecipesExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from platform_recipes
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="com.metro.auth.platform.domain.auth.PlatformRecipes">
......@@ -154,15 +133,15 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into platform_recipes (id, title, datetime,
weekday, memo, status,am_zs,am_fs,am_qt,pm_zs,pm_fs,pm_bc,pm_qt,soup,line
)
values (#{id,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{datetime,jdbcType=VARCHAR},
#{weekday,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}
insert into platform_recipes (id, title, datetime,
weekday, memo, status,am_zs,am_fs,am_qt,pm_zs,pm_fs,pm_bc,pm_qt,soup,line
)
values (#{id,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{datetime,jdbcType=VARCHAR},
#{weekday,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}
, #{am_zs,jdbcType=VARCHAR}, #{am_fs,jdbcType=VARCHAR}, #{am_qt,jdbcType=VARCHAR}, #{pm_zs,jdbcType=VARCHAR}
, #{pm_fs,jdbcType=VARCHAR}, #{pm_bc,jdbcType=VARCHAR}, #{pm_qt,jdbcType=VARCHAR}, #{soup,jdbcType=VARCHAR}
, #{line,jdbcType=VARCHAR}
)
)
</insert>
<insert id="insertSelective" parameterType="com.metro.auth.platform.domain.auth.PlatformRecipes">
<!--
......@@ -214,14 +193,15 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformRecipesExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="com.metro.auth.platform.domain.auth.PlatformRecipesExample"
resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from platform_recipes
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
......@@ -278,7 +258,7 @@
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
......@@ -288,11 +268,11 @@
-->
update platform_recipes
set id = #{record.id,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
datetime = #{record.datetime,jdbcType=VARCHAR},
weekday = #{record.weekday,jdbcType=VARCHAR},
memo = #{record.memo,jdbcType=VARCHAR},
status = #{record.status,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
datetime = #{record.datetime,jdbcType=VARCHAR},
weekday = #{record.weekday,jdbcType=VARCHAR},
memo = #{record.memo,jdbcType=VARCHAR},
status = #{record.status,jdbcType=VARCHAR},
am_zs = #{record.am_zs,jdbcType=VARCHAR},
am_fs = #{record.am_fs,jdbcType=VARCHAR},
am_qt = #{record.am_qt,jdbcType=VARCHAR},
......@@ -303,7 +283,7 @@
soup = #{record.soup,jdbcType=VARCHAR},
line = #{record.line,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.metro.auth.platform.domain.auth.PlatformRecipes">
......@@ -365,11 +345,11 @@
-->
update platform_recipes
set title = #{title,jdbcType=VARCHAR},
datetime = #{datetime,jdbcType=VARCHAR},
weekday = #{weekday,jdbcType=VARCHAR},
memo = #{memo,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
am_zs = #{am_zs,jdbcType=VARCHAR},
datetime = #{datetime,jdbcType=VARCHAR},
weekday = #{weekday,jdbcType=VARCHAR},
memo = #{memo,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
am_zs = #{am_zs,jdbcType=VARCHAR},
am_fs = #{am_fs,jdbcType=VARCHAR},
am_qt = #{am_qt,jdbcType=VARCHAR},
pm_zs = #{pm_zs,jdbcType=VARCHAR},
......@@ -380,13 +360,13 @@
line = #{line,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateStatusByPrimaryKey" parameterType="com.metro.auth.platform.domain.auth.PlatformRecipes" >
<update id="updateStatusByPrimaryKey" parameterType="com.metro.auth.platform.domain.auth.PlatformRecipes">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update platform_recipes
set status = #{status,jdbcType=VARCHAR}
set status = #{status,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
......@@ -40,4 +40,9 @@ public interface PlatformRecipesService {
PlatformRecipes loadByDateAndLine(Map params);
void updateRecipesStatus(String status, String ids);
/**
* 查询所有线路
*/
List<PlatformRecipes> selectLine();
}
......@@ -21,24 +21,27 @@ import java.util.UUID;
@Slf4j
@Service
public class PlatformRecipesServiceImpl implements PlatformRecipesService{
public class PlatformRecipesServiceImpl implements PlatformRecipesService {
@Resource
private PlatformRecipesMapper platformRecipesMapper;
private final JwtUtils jwtTokenUtil;
public PlatformRecipesServiceImpl(JwtUtils jwtTokenUtil) {
this.jwtTokenUtil = jwtTokenUtil;
}
@Resource
public HttpAPIService httpAPIService;
@Override
@DataDictClass
public List<PlatformRecipes> selectByExample(PlatformRecipes platformRecipes) {
PlatformRecipesExample example = new PlatformRecipesExample();
PlatformRecipesExample.Criteria criteria=example.createCriteria();
if (!EmptyUtilHelper.isEmpty(platformRecipes.getDatetime())){
PlatformRecipesExample.Criteria criteria = example.createCriteria();
if (!EmptyUtilHelper.isEmpty(platformRecipes.getDatetime())) {
criteria.andDatetimeGreaterThanOrEqualTo(platformRecipes.getDatetime());
}
if (!EmptyUtilHelper.isEmpty(platformRecipes.getLine())){
if (!EmptyUtilHelper.isEmpty(platformRecipes.getLine())) {
criteria.andLineEqualTo(platformRecipes.getLine());
}
criteria.andStatusEqualTo("1");
......@@ -46,15 +49,16 @@ public class PlatformRecipesServiceImpl implements PlatformRecipesService{
return platformRecipesMapper.selectByExample(example);
}
@Override
@DataDictClass
public List<PlatformRecipes> selectByExampleForexcel(PlatformRecipes platformRecipes) {
PlatformRecipesExample example = new PlatformRecipesExample();
PlatformRecipesExample.Criteria criteria=example.createCriteria();
if (!EmptyUtilHelper.isEmpty(platformRecipes.getDatetime())){
PlatformRecipesExample.Criteria criteria = example.createCriteria();
if (!EmptyUtilHelper.isEmpty(platformRecipes.getDatetime())) {
criteria.andDatetimeGreaterThanOrEqualTo(platformRecipes.getDatetime());
}
if (!EmptyUtilHelper.isEmpty(platformRecipes.getLine())){
if (!EmptyUtilHelper.isEmpty(platformRecipes.getLine())) {
criteria.andLineEqualTo(platformRecipes.getLine());
}
// criteria.andStatusEqualTo("1");
......@@ -62,59 +66,59 @@ public class PlatformRecipesServiceImpl implements PlatformRecipesService{
return platformRecipesMapper.selectByExample(example);
}
@Override
public int savePlatformRecipes(PlatformRecipes entity){
int flag=0;
public int savePlatformRecipes(PlatformRecipes entity) {
int flag = 0;
Date d = new Date();
//获取最新id
//获取最新id
String uuid = UUID.randomUUID().toString();
uuid = uuid.replace("-", "");
entity.setId(uuid);
if (StringUtil.isEmpty(entity.getStatus())) {
entity.setStatus("1");
}
flag=platformRecipesMapper.insert(entity);
flag = platformRecipesMapper.insert(entity);
return flag;
}
}
/**
*
* @param entity
* @return
*/
@Override
public int saveUpdatePlatformRecipes(PlatformRecipes entity){
int flag=0;
flag=platformRecipesMapper.updateByPrimaryKey(entity);
public int saveUpdatePlatformRecipes(PlatformRecipes entity) {
int flag = 0;
flag = platformRecipesMapper.updateByPrimaryKey(entity);
return flag;
}
/**
*
* @param id
* @return
*/
@Override
public int delPlatformRecipes(String id){
int flag=platformRecipesMapper.deleteByPrimaryKey(id);
@Override
public int delPlatformRecipes(String id) {
int flag = platformRecipesMapper.deleteByPrimaryKey(id);
return flag;
}
return flag;
}
/**
*根据id更新启用状态
* 根据id更新启用状态
*
* @param entity
* @return
*/
@Override
public int updatePlatformRecipesStatusById(PlatformRecipes entity){
int flag=0;
//更改状态
flag= platformRecipesMapper.updateStatusByPrimaryKey(entity);
return flag;
}
public int updatePlatformRecipesStatusById(PlatformRecipes entity) {
int flag = 0;
//更改状态
flag = platformRecipesMapper.updateStatusByPrimaryKey(entity);
return flag;
}
/**
*
* @param platformRecipes
* @param pageNum
* @param pageSize
......@@ -122,55 +126,60 @@ public class PlatformRecipesServiceImpl implements PlatformRecipesService{
*/
@Override
@DataDictClass
public PageInfo<PlatformRecipes> pagedlist(PlatformRecipes platformRecipes, int pageNum, int pageSize) {
public PageInfo<PlatformRecipes> pagedlist(PlatformRecipes platformRecipes, int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
PageHelper.startPage(pageNum, pageSize);
PlatformRecipesExample platformRecipesExample = new PlatformRecipesExample();
PlatformRecipesExample.Criteria criteria = platformRecipesExample.createCriteria();
//搜索
if (platformRecipes!=null){
if (!EmptyUtilHelper.isEmpty(platformRecipes.getTitle())){
criteria.andTitleLike( "%"+platformRecipes.getTitle()+"%");
}
if (!EmptyUtilHelper.isEmpty(platformRecipes.getLine())){
criteria.andLineLike( "%"+platformRecipes.getLine()+"%");
}
if (!EmptyUtilHelper.isEmpty(platformRecipes.getDatetime())){
criteria.andDatetimeEqualTo(platformRecipes.getDatetime());
}
//搜索
if (platformRecipes != null) {
if (!EmptyUtilHelper.isEmpty(platformRecipes.getTitle())) {
criteria.andTitleLike("%" + platformRecipes.getTitle() + "%");
}
if (!EmptyUtilHelper.isEmpty(platformRecipes.getLine())) {
criteria.andLineLike("%" + platformRecipes.getLine() + "%");
}
if (!EmptyUtilHelper.isEmpty(platformRecipes.getDatetime())) {
criteria.andDatetimeEqualTo(platformRecipes.getDatetime());
}
}
platformRecipesExample.setOrderByClause(" datetime desc");
List<PlatformRecipes> list=platformRecipesMapper.selectByExample(platformRecipesExample);
PageInfo<PlatformRecipes> pageInfo = new PageInfo<>(list);
List<PlatformRecipes> list = platformRecipesMapper.selectByExample(platformRecipesExample);
PageInfo<PlatformRecipes> pageInfo = new PageInfo<>(list);
return pageInfo;
}
@Override
public PlatformRecipes load(String id) {
PlatformRecipes platformRecipes = platformRecipesMapper.selectByPrimaryKey(id);
return platformRecipes;
}
return pageInfo;
}
@Override
public PlatformRecipes load(String id){
PlatformRecipes platformRecipes=platformRecipesMapper.selectByPrimaryKey(id);
return platformRecipes;
}
/**
* 批量启停,微信无操作
*
* @param status
* @param ids
*/
@Override
public void updateRecipesStatus(String status,String ids) {
public void updateRecipesStatus(String status, String ids) {
String[] id = ids.split(",");
for (int i=0;i<id.length;i++ ) {
PlatformRecipes platformRecipes=platformRecipesMapper.selectByPrimaryKey(id[i]);
for (int i = 0; i < id.length; i++) {
PlatformRecipes platformRecipes = platformRecipesMapper.selectByPrimaryKey(id[i]);
platformRecipes.setStatus(status);
int flag=platformRecipesMapper.updateStatusByPrimaryKey(platformRecipes);
int flag = platformRecipesMapper.updateStatusByPrimaryKey(platformRecipes);
}
}
@Override
public PlatformRecipes loadByDateAndLine(Map params){
PlatformRecipes platformRecipes=platformRecipesMapper.loadByDateAndLine(params);
return platformRecipes;
public PlatformRecipes loadByDateAndLine(Map params) {
PlatformRecipes platformRecipes = platformRecipesMapper.loadByDateAndLine(params);
return platformRecipes;
}
@Override
@DataDictClass
public PageInfo<PlatformRecipes> pagedlisthome(PlatformRecipes platformRecipes, int pageNum, int pageSize) {
......@@ -179,23 +188,31 @@ public class PlatformRecipesServiceImpl implements PlatformRecipesService{
PlatformRecipesExample platformRecipesExample = new PlatformRecipesExample();
PlatformRecipesExample.Criteria criteria = platformRecipesExample.createCriteria();
//搜索
if (platformRecipes!=null){
if (platformRecipes != null) {
// if (!EmptyUtilHelper.isEmpty(platformRecipes.getTitle())){
// criteria.andTitleLike( "%"+platformRecipes.getTitle()+"%");
// }
if (!EmptyUtilHelper.isEmpty(platformRecipes.getDatetime())){
if (!EmptyUtilHelper.isEmpty(platformRecipes.getDatetime())) {
criteria.andDatetimeEqualTo(platformRecipes.getDatetime());
}
if (!EmptyUtilHelper.isEmpty(platformRecipes.getLine())){
if (!EmptyUtilHelper.isEmpty(platformRecipes.getLine())) {
criteria.andLineEqualTo(platformRecipes.getLine());
}
}
criteria.andStatusEqualTo("1");
platformRecipesExample.setOrderByClause(" datetime desc");
List<PlatformRecipes> list=platformRecipesMapper.selectByExample(platformRecipesExample);
List<PlatformRecipes> list = platformRecipesMapper.selectByExample(platformRecipesExample);
PageInfo<PlatformRecipes> pageInfo = new PageInfo<>(list);
return pageInfo;
}
/**
* 查询所有线路
*/
@Override
public List<PlatformRecipes> selectLine() {
return platformRecipesMapper.selectLine();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论