小bug修复,修改上传文件名称生成逻辑

This commit is contained in:
mi9688 2024-11-26 18:35:22 +08:00
parent 45b3381eb2
commit 032f980f34
14 changed files with 893 additions and 3 deletions

View File

@ -138,8 +138,8 @@ public class FileUploadUtils
*/
public static final String extractFilename(MultipartFile file)
{
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
return StringUtils.format("{}/_{}.{}", DateUtils.datePath(),
Seq.getId(Seq.uploadSeqType), getExtension(file));
}
public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException

View File

@ -0,0 +1,110 @@
package com.fastbee.data.controller.aaScreenAgricultural;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fastbee.common.annotation.Log;
import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.enums.BusinessType;
import com.fastbee.crop.domain.AgricultureCropInfo;
import com.fastbee.crop.service.IAgricultureCropInfoService;
import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.common.core.page.TableDataInfo;
/**
* 农作物信息管理Controller
*
* @author kerwincui
* @date 2024-11-26
*/
@RestController
@RequestMapping("/crop/info")
@Api(tags = "农作物信息管理")
public class AgricultureCropInfoController extends BaseController
{
@Autowired
private IAgricultureCropInfoService agricultureCropInfoService;
/**
* 查询农作物信息管理列表
*/
@PreAuthorize("@ss.hasPermi('crop:crop:list')")
@GetMapping("/list")
@ApiOperation("查询农作物信息管理列表")
public TableDataInfo list(AgricultureCropInfo agricultureCropInfo)
{
startPage();
List<AgricultureCropInfo> list = agricultureCropInfoService.selectAgricultureCropInfoList(agricultureCropInfo);
return getDataTable(list);
}
/**
* 导出农作物信息管理列表
*/
@ApiOperation("导出农作物信息管理列表")
@PreAuthorize("@ss.hasPermi('crop:crop:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, AgricultureCropInfo agricultureCropInfo)
{
List<AgricultureCropInfo> list = agricultureCropInfoService.selectAgricultureCropInfoList(agricultureCropInfo);
ExcelUtil<AgricultureCropInfo> util = new ExcelUtil<AgricultureCropInfo>(AgricultureCropInfo.class);
util.exportExcel(response, list, "农作物信息管理数据");
}
/**
* 获取农作物信息管理详细信息
*/
@PreAuthorize("@ss.hasPermi('crop:crop:query')")
@GetMapping(value = "/{id}")
@ApiOperation("获取农作物信息管理详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(agricultureCropInfoService.selectAgricultureCropInfoById(id));
}
/**
* 新增农作物信息管理
*/
@PreAuthorize("@ss.hasPermi('crop:crop:add')")
@PostMapping
@ApiOperation("新增农作物信息管理")
public AjaxResult add(@RequestBody AgricultureCropInfo agricultureCropInfo)
{
return toAjax(agricultureCropInfoService.insertAgricultureCropInfo(agricultureCropInfo));
}
/**
* 修改农作物信息管理
*/
@PreAuthorize("@ss.hasPermi('crop:crop:edit')")
@PutMapping
@ApiOperation("修改农作物信息管理")
public AjaxResult edit(@RequestBody AgricultureCropInfo agricultureCropInfo)
{
return toAjax(agricultureCropInfoService.updateAgricultureCropInfo(agricultureCropInfo));
}
/**
* 删除农作物信息管理
*/
@PreAuthorize("@ss.hasPermi('crop:crop:remove')")
@DeleteMapping("/{ids}")
@ApiOperation("删除农作物信息管理")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(agricultureCropInfoService.deleteAgricultureCropInfoByIds(ids));
}
}

View File

@ -0,0 +1,110 @@
package com.fastbee.data.controller.aaScreenAgricultural;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fastbee.common.annotation.Log;
import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.enums.BusinessType;
import com.fastbee.crop.domain.AgricultureCropYield;
import com.fastbee.crop.service.IAgricultureCropYieldService;
import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.common.core.page.TableDataInfo;
/**
* 作物产量记录Controller
*
* @author kerwincui
* @date 2024-11-26
*/
@RestController
@RequestMapping("/crop/yield")
@Api(tags = "作物产量记录")
public class AgricultureCropYieldController extends BaseController
{
@Autowired
private IAgricultureCropYieldService agricultureCropYieldService;
/**
* 查询作物产量记录列表
*/
@PreAuthorize("@ss.hasPermi('crop:yield:list')")
@GetMapping("/list")
@ApiOperation("查询作物产量记录列表")
public TableDataInfo list(AgricultureCropYield agricultureCropYield)
{
startPage();
List<AgricultureCropYield> list = agricultureCropYieldService.selectAgricultureCropYieldList(agricultureCropYield);
return getDataTable(list);
}
/**
* 导出作物产量记录列表
*/
@ApiOperation("导出作物产量记录列表")
@PreAuthorize("@ss.hasPermi('crop:yield:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, AgricultureCropYield agricultureCropYield)
{
List<AgricultureCropYield> list = agricultureCropYieldService.selectAgricultureCropYieldList(agricultureCropYield);
ExcelUtil<AgricultureCropYield> util = new ExcelUtil<AgricultureCropYield>(AgricultureCropYield.class);
util.exportExcel(response, list, "作物产量记录数据");
}
/**
* 获取作物产量记录详细信息
*/
@PreAuthorize("@ss.hasPermi('crop:yield:query')")
@GetMapping(value = "/{id}")
@ApiOperation("获取作物产量记录详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(agricultureCropYieldService.selectAgricultureCropYieldById(id));
}
/**
* 新增作物产量记录
*/
@PreAuthorize("@ss.hasPermi('crop:yield:add')")
@PostMapping
@ApiOperation("新增作物产量记录")
public AjaxResult add(@RequestBody AgricultureCropYield agricultureCropYield)
{
return toAjax(agricultureCropYieldService.insertAgricultureCropYield(agricultureCropYield));
}
/**
* 修改作物产量记录
*/
@PreAuthorize("@ss.hasPermi('crop:yield:edit')")
@PutMapping
@ApiOperation("修改作物产量记录")
public AjaxResult edit(@RequestBody AgricultureCropYield agricultureCropYield)
{
return toAjax(agricultureCropYieldService.updateAgricultureCropYield(agricultureCropYield));
}
/**
* 删除作物产量记录
*/
@PreAuthorize("@ss.hasPermi('crop:yield:remove')")
@DeleteMapping("/{ids}")
@ApiOperation("删除作物产量记录")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(agricultureCropYieldService.deleteAgricultureCropYieldByIds(ids));
}
}

View File

@ -0,0 +1,49 @@
package com.fastbee.crop.domain;
import java.math.BigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.fastbee.common.annotation.Excel;
import com.fastbee.common.core.domain.BaseEntity;
/**
* 农作物信息管理对象 agriculture_crop_info
*
* @author kerwincui
* @date 2024-11-26
*/
@ApiModel(value = "AgricultureCropInfo",description = "农作物信息管理 agriculture_crop_info")
@Data
@EqualsAndHashCode(callSuper = true)
public class AgricultureCropInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private Long id;
/** 作物名称 */
@Excel(name = "作物名称")
@ApiModelProperty("作物名称")
private String cropName;
/** sheng'zh1. **播种期** 2. **分蘖期** 3. **拔节期** 4. **抽穗期** 5. **成熟期** */
@Excel(name = "sheng'zh1. **播种期** 2. **分蘖期** 3. **拔节期** 4. **抽穗期** 5. **成熟期** ")
@ApiModelProperty("sheng'zh1. **播种期** 2. **分蘖期** 3. **拔节期** 4. **抽穗期** 5. **成熟期** ")
private String growthPeriod;
/** 种植面积(单位:平方米) */
@Excel(name = "种植面积", readConverterExp = "单=位:平方米")
@ApiModelProperty("种植面积")
private BigDecimal plantingArea;
/** 其他信息 */
@Excel(name = "其他信息")
@ApiModelProperty("其他信息")
private String otherInfo;
}

View File

@ -0,0 +1,49 @@
package com.fastbee.crop.domain;
import java.math.BigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.fastbee.common.annotation.Excel;
import com.fastbee.common.core.domain.BaseEntity;
/**
* 作物产量记录对象 agriculture_crop_yield
*
* @author kerwincui
* @date 2024-11-26
*/
@ApiModel(value = "AgricultureCropYield",description = "作物产量记录 agriculture_crop_yield")
@Data
@EqualsAndHashCode(callSuper = true)
public class AgricultureCropYield extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 产量值(单位:千克) */
@Excel(name = "产量值", readConverterExp = "单=位:千克")
@ApiModelProperty("产量值")
private BigDecimal yieldValue;
/** 收获年 */
@Excel(name = "收获年")
@ApiModelProperty("收获年")
private String harvestYear;
/** 作物类型 */
@Excel(name = "作物类型")
@ApiModelProperty("作物类型")
private String cropType;
/** 收获月 */
@Excel(name = "收获月")
@ApiModelProperty("收获月")
private String harvestMonth;
}

View File

@ -0,0 +1,61 @@
package com.fastbee.crop.mapper;
import java.util.List;
import com.fastbee.crop.domain.AgricultureCropInfo;
/**
* 农作物信息管理Mapper接口
*
* @author kerwincui
* @date 2024-11-26
*/
public interface AgricultureCropInfoMapper
{
/**
* 查询农作物信息管理
*
* @param id 农作物信息管理主键
* @return 农作物信息管理
*/
public AgricultureCropInfo selectAgricultureCropInfoById(Long id);
/**
* 查询农作物信息管理列表
*
* @param agricultureCropInfo 农作物信息管理
* @return 农作物信息管理集合
*/
public List<AgricultureCropInfo> selectAgricultureCropInfoList(AgricultureCropInfo agricultureCropInfo);
/**
* 新增农作物信息管理
*
* @param agricultureCropInfo 农作物信息管理
* @return 结果
*/
public int insertAgricultureCropInfo(AgricultureCropInfo agricultureCropInfo);
/**
* 修改农作物信息管理
*
* @param agricultureCropInfo 农作物信息管理
* @return 结果
*/
public int updateAgricultureCropInfo(AgricultureCropInfo agricultureCropInfo);
/**
* 删除农作物信息管理
*
* @param id 农作物信息管理主键
* @return 结果
*/
public int deleteAgricultureCropInfoById(Long id);
/**
* 批量删除农作物信息管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteAgricultureCropInfoByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.fastbee.crop.mapper;
import java.util.List;
import com.fastbee.crop.domain.AgricultureCropYield;
/**
* 作物产量记录Mapper接口
*
* @author kerwincui
* @date 2024-11-26
*/
public interface AgricultureCropYieldMapper
{
/**
* 查询作物产量记录
*
* @param id 作物产量记录主键
* @return 作物产量记录
*/
public AgricultureCropYield selectAgricultureCropYieldById(Long id);
/**
* 查询作物产量记录列表
*
* @param agricultureCropYield 作物产量记录
* @return 作物产量记录集合
*/
public List<AgricultureCropYield> selectAgricultureCropYieldList(AgricultureCropYield agricultureCropYield);
/**
* 新增作物产量记录
*
* @param agricultureCropYield 作物产量记录
* @return 结果
*/
public int insertAgricultureCropYield(AgricultureCropYield agricultureCropYield);
/**
* 修改作物产量记录
*
* @param agricultureCropYield 作物产量记录
* @return 结果
*/
public int updateAgricultureCropYield(AgricultureCropYield agricultureCropYield);
/**
* 删除作物产量记录
*
* @param id 作物产量记录主键
* @return 结果
*/
public int deleteAgricultureCropYieldById(Long id);
/**
* 批量删除作物产量记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteAgricultureCropYieldByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.fastbee.crop.service;
import java.util.List;
import com.fastbee.crop.domain.AgricultureCropInfo;
/**
* 农作物信息管理Service接口
*
* @author kerwincui
* @date 2024-11-26
*/
public interface IAgricultureCropInfoService
{
/**
* 查询农作物信息管理
*
* @param id 农作物信息管理主键
* @return 农作物信息管理
*/
public AgricultureCropInfo selectAgricultureCropInfoById(Long id);
/**
* 查询农作物信息管理列表
*
* @param agricultureCropInfo 农作物信息管理
* @return 农作物信息管理集合
*/
public List<AgricultureCropInfo> selectAgricultureCropInfoList(AgricultureCropInfo agricultureCropInfo);
/**
* 新增农作物信息管理
*
* @param agricultureCropInfo 农作物信息管理
* @return 结果
*/
public int insertAgricultureCropInfo(AgricultureCropInfo agricultureCropInfo);
/**
* 修改农作物信息管理
*
* @param agricultureCropInfo 农作物信息管理
* @return 结果
*/
public int updateAgricultureCropInfo(AgricultureCropInfo agricultureCropInfo);
/**
* 批量删除农作物信息管理
*
* @param ids 需要删除的农作物信息管理主键集合
* @return 结果
*/
public int deleteAgricultureCropInfoByIds(Long[] ids);
/**
* 删除农作物信息管理信息
*
* @param id 农作物信息管理主键
* @return 结果
*/
public int deleteAgricultureCropInfoById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.fastbee.crop.service;
import java.util.List;
import com.fastbee.crop.domain.AgricultureCropYield;
/**
* 作物产量记录Service接口
*
* @author kerwincui
* @date 2024-11-26
*/
public interface IAgricultureCropYieldService
{
/**
* 查询作物产量记录
*
* @param id 作物产量记录主键
* @return 作物产量记录
*/
public AgricultureCropYield selectAgricultureCropYieldById(Long id);
/**
* 查询作物产量记录列表
*
* @param agricultureCropYield 作物产量记录
* @return 作物产量记录集合
*/
public List<AgricultureCropYield> selectAgricultureCropYieldList(AgricultureCropYield agricultureCropYield);
/**
* 新增作物产量记录
*
* @param agricultureCropYield 作物产量记录
* @return 结果
*/
public int insertAgricultureCropYield(AgricultureCropYield agricultureCropYield);
/**
* 修改作物产量记录
*
* @param agricultureCropYield 作物产量记录
* @return 结果
*/
public int updateAgricultureCropYield(AgricultureCropYield agricultureCropYield);
/**
* 批量删除作物产量记录
*
* @param ids 需要删除的作物产量记录主键集合
* @return 结果
*/
public int deleteAgricultureCropYieldByIds(Long[] ids);
/**
* 删除作物产量记录信息
*
* @param id 作物产量记录主键
* @return 结果
*/
public int deleteAgricultureCropYieldById(Long id);
}

View File

@ -0,0 +1,93 @@
package com.fastbee.crop.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.crop.mapper.AgricultureCropInfoMapper;
import com.fastbee.crop.domain.AgricultureCropInfo;
import com.fastbee.crop.service.IAgricultureCropInfoService;
/**
* 农作物信息管理Service业务层处理
*
* @author kerwincui
* @date 2024-11-26
*/
@Service
public class AgricultureCropInfoServiceImpl implements IAgricultureCropInfoService
{
@Autowired
private AgricultureCropInfoMapper agricultureCropInfoMapper;
/**
* 查询农作物信息管理
*
* @param id 农作物信息管理主键
* @return 农作物信息管理
*/
@Override
public AgricultureCropInfo selectAgricultureCropInfoById(Long id)
{
return agricultureCropInfoMapper.selectAgricultureCropInfoById(id);
}
/**
* 查询农作物信息管理列表
*
* @param agricultureCropInfo 农作物信息管理
* @return 农作物信息管理
*/
@Override
public List<AgricultureCropInfo> selectAgricultureCropInfoList(AgricultureCropInfo agricultureCropInfo)
{
return agricultureCropInfoMapper.selectAgricultureCropInfoList(agricultureCropInfo);
}
/**
* 新增农作物信息管理
*
* @param agricultureCropInfo 农作物信息管理
* @return 结果
*/
@Override
public int insertAgricultureCropInfo(AgricultureCropInfo agricultureCropInfo)
{
return agricultureCropInfoMapper.insertAgricultureCropInfo(agricultureCropInfo);
}
/**
* 修改农作物信息管理
*
* @param agricultureCropInfo 农作物信息管理
* @return 结果
*/
@Override
public int updateAgricultureCropInfo(AgricultureCropInfo agricultureCropInfo)
{
return agricultureCropInfoMapper.updateAgricultureCropInfo(agricultureCropInfo);
}
/**
* 批量删除农作物信息管理
*
* @param ids 需要删除的农作物信息管理主键
* @return 结果
*/
@Override
public int deleteAgricultureCropInfoByIds(Long[] ids)
{
return agricultureCropInfoMapper.deleteAgricultureCropInfoByIds(ids);
}
/**
* 删除农作物信息管理信息
*
* @param id 农作物信息管理主键
* @return 结果
*/
@Override
public int deleteAgricultureCropInfoById(Long id)
{
return agricultureCropInfoMapper.deleteAgricultureCropInfoById(id);
}
}

View File

@ -0,0 +1,93 @@
package com.fastbee.crop.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.crop.mapper.AgricultureCropYieldMapper;
import com.fastbee.crop.domain.AgricultureCropYield;
import com.fastbee.crop.service.IAgricultureCropYieldService;
/**
* 作物产量记录Service业务层处理
*
* @author kerwincui
* @date 2024-11-26
*/
@Service
public class AgricultureCropYieldServiceImpl implements IAgricultureCropYieldService
{
@Autowired
private AgricultureCropYieldMapper agricultureCropYieldMapper;
/**
* 查询作物产量记录
*
* @param id 作物产量记录主键
* @return 作物产量记录
*/
@Override
public AgricultureCropYield selectAgricultureCropYieldById(Long id)
{
return agricultureCropYieldMapper.selectAgricultureCropYieldById(id);
}
/**
* 查询作物产量记录列表
*
* @param agricultureCropYield 作物产量记录
* @return 作物产量记录
*/
@Override
public List<AgricultureCropYield> selectAgricultureCropYieldList(AgricultureCropYield agricultureCropYield)
{
return agricultureCropYieldMapper.selectAgricultureCropYieldList(agricultureCropYield);
}
/**
* 新增作物产量记录
*
* @param agricultureCropYield 作物产量记录
* @return 结果
*/
@Override
public int insertAgricultureCropYield(AgricultureCropYield agricultureCropYield)
{
return agricultureCropYieldMapper.insertAgricultureCropYield(agricultureCropYield);
}
/**
* 修改作物产量记录
*
* @param agricultureCropYield 作物产量记录
* @return 结果
*/
@Override
public int updateAgricultureCropYield(AgricultureCropYield agricultureCropYield)
{
return agricultureCropYieldMapper.updateAgricultureCropYield(agricultureCropYield);
}
/**
* 批量删除作物产量记录
*
* @param ids 需要删除的作物产量记录主键
* @return 结果
*/
@Override
public int deleteAgricultureCropYieldByIds(Long[] ids)
{
return agricultureCropYieldMapper.deleteAgricultureCropYieldByIds(ids);
}
/**
* 删除作物产量记录信息
*
* @param id 作物产量记录主键
* @return 结果
*/
@Override
public int deleteAgricultureCropYieldById(Long id)
{
return agricultureCropYieldMapper.deleteAgricultureCropYieldById(id);
}
}

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fastbee.crop.mapper.AgricultureCropInfoMapper">
<resultMap type="AgricultureCropInfo" id="AgricultureCropInfoResult">
<result property="id" column="id" />
<result property="cropName" column="crop_name" />
<result property="growthPeriod" column="growth_period" />
<result property="plantingArea" column="planting_area" />
<result property="otherInfo" column="other_info" />
</resultMap>
<sql id="selectAgricultureCropInfoVo">
select id, crop_name, growth_period, planting_area, other_info from agriculture_crop_info
</sql>
<select id="selectAgricultureCropInfoList" parameterType="AgricultureCropInfo" resultMap="AgricultureCropInfoResult">
<include refid="selectAgricultureCropInfoVo"/>
<where>
<if test="cropName != null and cropName != ''"> and crop_name like concat('%', #{cropName}, '%')</if>
<if test="growthPeriod != null and growthPeriod != ''"> and growth_period = #{growthPeriod}</if>
<if test="plantingArea != null "> and planting_area = #{plantingArea}</if>
<if test="otherInfo != null and otherInfo != ''"> and other_info = #{otherInfo}</if>
</where>
</select>
<select id="selectAgricultureCropInfoById" parameterType="Long" resultMap="AgricultureCropInfoResult">
<include refid="selectAgricultureCropInfoVo"/>
where id = #{id}
</select>
<insert id="insertAgricultureCropInfo" parameterType="AgricultureCropInfo" useGeneratedKeys="true" keyProperty="id">
insert into agriculture_crop_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cropName != null">crop_name,</if>
<if test="growthPeriod != null">growth_period,</if>
<if test="plantingArea != null">planting_area,</if>
<if test="otherInfo != null">other_info,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cropName != null">#{cropName},</if>
<if test="growthPeriod != null">#{growthPeriod},</if>
<if test="plantingArea != null">#{plantingArea},</if>
<if test="otherInfo != null">#{otherInfo},</if>
</trim>
</insert>
<update id="updateAgricultureCropInfo" parameterType="AgricultureCropInfo">
update agriculture_crop_info
<trim prefix="SET" suffixOverrides=",">
<if test="cropName != null">crop_name = #{cropName},</if>
<if test="growthPeriod != null">growth_period = #{growthPeriod},</if>
<if test="plantingArea != null">planting_area = #{plantingArea},</if>
<if test="otherInfo != null">other_info = #{otherInfo},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAgricultureCropInfoById" parameterType="Long">
delete from agriculture_crop_info where id = #{id}
</delete>
<delete id="deleteAgricultureCropInfoByIds" parameterType="String">
delete from agriculture_crop_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fastbee.crop.mapper.AgricultureCropYieldMapper">
<resultMap type="AgricultureCropYield" id="AgricultureCropYieldResult">
<result property="id" column="id" />
<result property="yieldValue" column="yield_value" />
<result property="harvestYear" column="harvest_year" />
<result property="cropType" column="crop_type" />
<result property="harvestMonth" column="harvest_month" />
</resultMap>
<sql id="selectAgricultureCropYieldVo">
select id, yield_value, harvest_year, crop_type, harvest_month from agriculture_crop_yield
</sql>
<select id="selectAgricultureCropYieldList" parameterType="AgricultureCropYield" resultMap="AgricultureCropYieldResult">
<include refid="selectAgricultureCropYieldVo"/>
<where>
<if test="yieldValue != null "> and yield_value = #{yieldValue}</if>
<if test="harvestYear != null and harvestYear != ''"> and harvest_year = #{harvestYear}</if>
<if test="cropType != null and cropType != ''"> and crop_type = #{cropType}</if>
<if test="harvestMonth != null and harvestMonth != ''"> and harvest_month = #{harvestMonth}</if>
</where>
</select>
<select id="selectAgricultureCropYieldById" parameterType="Long" resultMap="AgricultureCropYieldResult">
<include refid="selectAgricultureCropYieldVo"/>
where id = #{id}
</select>
<insert id="insertAgricultureCropYield" parameterType="AgricultureCropYield" useGeneratedKeys="true" keyProperty="id">
insert into agriculture_crop_yield
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="yieldValue != null">yield_value,</if>
<if test="harvestYear != null">harvest_year,</if>
<if test="cropType != null">crop_type,</if>
<if test="harvestMonth != null">harvest_month,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="yieldValue != null">#{yieldValue},</if>
<if test="harvestYear != null">#{harvestYear},</if>
<if test="cropType != null">#{cropType},</if>
<if test="harvestMonth != null">#{harvestMonth},</if>
</trim>
</insert>
<update id="updateAgricultureCropYield" parameterType="AgricultureCropYield">
update agriculture_crop_yield
<trim prefix="SET" suffixOverrides=",">
<if test="yieldValue != null">yield_value = #{yieldValue},</if>
<if test="harvestYear != null">harvest_year = #{harvestYear},</if>
<if test="cropType != null">crop_type = #{cropType},</if>
<if test="harvestMonth != null">harvest_month = #{harvestMonth},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAgricultureCropYieldById" parameterType="Long">
delete from agriculture_crop_yield where id = #{id}
</delete>
<delete id="deleteAgricultureCropYieldByIds" parameterType="String">
delete from agriculture_crop_yield where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -206,7 +206,7 @@ public class SysRoleServiceImpl implements ISysRoleService
* @param roleId 角色ID
* @return 角色对象信息
*/
@Cacheable(value = "role", key = "#root.methodName + '_' + #roleId", unless = "#result == null")
// @Cacheable(value = "role", key = "#root.methodName + '_' + #roleId", unless = "#result == null")
@Override
public SysRole selectRoleById(Long roleId)
{