即将完成会员入驻的认领菜地。
This commit is contained in:
@ -42,6 +42,18 @@ public class FarmerContractController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询入驻会员合约的列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('csa:contract:list')")
|
||||
@GetMapping("/enter/list")
|
||||
public TableDataInfo enterList(FarmerContract farmerContract)
|
||||
{
|
||||
startPage();
|
||||
List<FarmerContract> list = farmerContractService.selectEnterContractList(farmerContract);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出会员签约列表
|
||||
*/
|
||||
|
@ -2,6 +2,8 @@ package com.jlt.csa.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.jlt.csa.domain.Garden;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -69,6 +71,20 @@ public class FarmerController extends BaseController
|
||||
return AjaxResult.success(farmerService.selectFarmerByFarmerId(farmerId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取带菜地信息的地主详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('csa:farmer:query')")
|
||||
@GetMapping(value = "/garden/{farmerId}")
|
||||
public AjaxResult getInfoWithGarden(@PathVariable("farmerId") Long farmerId)
|
||||
{
|
||||
Farmer farmer = farmerService.selectFarmerWithGardenById(farmerId);
|
||||
if (farmer.getGarden() == null)
|
||||
farmer.setGarden(new Garden());
|
||||
|
||||
return AjaxResult.success(farmer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增农场会员
|
||||
*/
|
||||
|
@ -42,6 +42,25 @@ public class GardenController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按代码筛选可绑定的菜地列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('csa:garden:query')")
|
||||
@GetMapping({"/cansell/{code}", "/cansell/"})
|
||||
public TableDataInfo listCanSell(@PathVariable(value = "code", required = false) String code)
|
||||
{
|
||||
logger.error("--==>" + code);
|
||||
Garden garden = new Garden();
|
||||
garden.setCode(code);
|
||||
garden.setIsCompleted("Y");
|
||||
garden.setIsSelled("N");
|
||||
garden.setStatus("0");
|
||||
|
||||
List<Garden> list = gardenService.selectGardenList(garden);
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出菜地划分列表
|
||||
*/
|
||||
|
@ -18,6 +18,9 @@ public class Farmer extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 菜地 */
|
||||
private Garden garden;
|
||||
|
||||
/** 会员id */
|
||||
private Long farmerId;
|
||||
|
||||
@ -29,9 +32,13 @@ public class Farmer extends BaseEntity
|
||||
@Excel(name = "性别")
|
||||
private String gender;
|
||||
|
||||
/** 手机号码 */
|
||||
@Excel(name = "手机号码")
|
||||
private String mobileNumber;
|
||||
|
||||
/** 金币余额 */
|
||||
@Excel(name = "金币余额")
|
||||
private BigDecimal coins;
|
||||
private Long coins;
|
||||
|
||||
/** 账户余额 */
|
||||
@Excel(name = "账户余额")
|
||||
@ -65,7 +72,15 @@ public class Farmer extends BaseEntity
|
||||
/** 删除标志 */
|
||||
private String delFlag;
|
||||
|
||||
public void setFarmerId(Long farmerId)
|
||||
public Garden getGarden() {
|
||||
return garden;
|
||||
}
|
||||
|
||||
public void setGarden(Garden garden) {
|
||||
this.garden = garden;
|
||||
}
|
||||
|
||||
public void setFarmerId(Long farmerId)
|
||||
{
|
||||
this.farmerId = farmerId;
|
||||
}
|
||||
@ -92,12 +107,21 @@ public class Farmer extends BaseEntity
|
||||
{
|
||||
return gender;
|
||||
}
|
||||
public void setCoins(BigDecimal coins)
|
||||
|
||||
public String getMobileNumber() {
|
||||
return mobileNumber;
|
||||
}
|
||||
|
||||
public void setMobileNumber(String mobileNumber) {
|
||||
this.mobileNumber = mobileNumber;
|
||||
}
|
||||
|
||||
public void setCoins(Long coins)
|
||||
{
|
||||
this.coins = coins;
|
||||
}
|
||||
|
||||
public BigDecimal getCoins()
|
||||
public Long getCoins()
|
||||
{
|
||||
return coins;
|
||||
}
|
||||
|
@ -30,13 +30,23 @@ public class FarmerContract extends BaseEntity
|
||||
@Excel(name = "会员id")
|
||||
private Long farmerId;
|
||||
|
||||
/** 地主 */
|
||||
private Farmer farmer;
|
||||
|
||||
/** 菜地id */
|
||||
@Excel(name = "菜地id")
|
||||
private Long gardenId;
|
||||
|
||||
/** 菜地 */
|
||||
private Farmer garden;
|
||||
|
||||
/** 签约人 */
|
||||
@Excel(name = "签约人")
|
||||
private String contractor;
|
||||
|
||||
/** 合约金币 */
|
||||
@Excel(name = "合约金币")
|
||||
private BigDecimal coins;
|
||||
private Long coins;
|
||||
|
||||
/** 合约账户金额 */
|
||||
@Excel(name = "合约账户金额")
|
||||
@ -120,6 +130,31 @@ public class FarmerContract extends BaseEntity
|
||||
{
|
||||
return farmerId;
|
||||
}
|
||||
|
||||
public Farmer getFarmer() {
|
||||
return farmer;
|
||||
}
|
||||
|
||||
public void setFarmer(Farmer farmer) {
|
||||
this.farmer = farmer;
|
||||
}
|
||||
|
||||
public Long getGardenId() {
|
||||
return gardenId;
|
||||
}
|
||||
|
||||
public void setGardenId(Long gardenId) {
|
||||
this.gardenId = gardenId;
|
||||
}
|
||||
|
||||
public Farmer getGarden() {
|
||||
return garden;
|
||||
}
|
||||
|
||||
public void setGarden(Farmer garden) {
|
||||
this.garden = garden;
|
||||
}
|
||||
|
||||
public void setContractor(String contractor)
|
||||
{
|
||||
this.contractor = contractor;
|
||||
@ -129,12 +164,12 @@ public class FarmerContract extends BaseEntity
|
||||
{
|
||||
return contractor;
|
||||
}
|
||||
public void setCoins(BigDecimal coins)
|
||||
public void setCoins(Long coins)
|
||||
{
|
||||
this.coins = coins;
|
||||
}
|
||||
|
||||
public BigDecimal getCoins()
|
||||
public Long getCoins()
|
||||
{
|
||||
return coins;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class Garden extends BaseEntity
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 菜地id */
|
||||
private Long id;
|
||||
private Long gardenId;
|
||||
|
||||
/** 农场分区 */
|
||||
@Excel(name = "农场分区")
|
||||
@ -36,11 +36,11 @@ public class Garden extends BaseEntity
|
||||
|
||||
/** 平方米 */
|
||||
@Excel(name = "平方米")
|
||||
private BigDecimal m2;
|
||||
private Integer m2;
|
||||
|
||||
/** 会员 */
|
||||
@Excel(name = "会员")
|
||||
private Long memberId;
|
||||
@Excel(name = "会员id")
|
||||
private Long farmerId;
|
||||
|
||||
/** 菜地管理员 */
|
||||
@Excel(name = "菜地管理员")
|
||||
@ -73,14 +73,14 @@ public class Garden extends BaseEntity
|
||||
/** 删除标志 */
|
||||
private String delFlag;
|
||||
|
||||
public void setId(Long id)
|
||||
public void setGardenId(Long gardenId)
|
||||
{
|
||||
this.id = id;
|
||||
this.gardenId = gardenId;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
public Long getGardenId()
|
||||
{
|
||||
return id;
|
||||
return gardenId;
|
||||
}
|
||||
public void setZoneId(Long zoneId)
|
||||
{
|
||||
@ -117,23 +117,23 @@ public class Garden extends BaseEntity
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setM2(BigDecimal m2)
|
||||
public void setM2(Integer m2)
|
||||
{
|
||||
this.m2 = m2;
|
||||
}
|
||||
|
||||
public BigDecimal getM2()
|
||||
public Integer getM2()
|
||||
{
|
||||
return m2;
|
||||
}
|
||||
public void setMemberId(Long memberId)
|
||||
public void setFarmerId(Long farmerId)
|
||||
{
|
||||
this.memberId = memberId;
|
||||
this.farmerId = farmerId;
|
||||
}
|
||||
|
||||
public Long getMemberId()
|
||||
public Long getFarmerId()
|
||||
{
|
||||
return memberId;
|
||||
return farmerId;
|
||||
}
|
||||
public void setManagerId(Long managerId)
|
||||
{
|
||||
@ -211,12 +211,12 @@ public class Garden extends BaseEntity
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("gardenId", getGardenId())
|
||||
.append("zoneId", getZoneId())
|
||||
.append("code", getCode())
|
||||
.append("name", getName())
|
||||
.append("m2", getM2())
|
||||
.append("memberId", getMemberId())
|
||||
.append("farmerId", getFarmerId())
|
||||
.append("managerId", getManagerId())
|
||||
.append("workerId", getWorkerId())
|
||||
.append("contacterId", getContacterId())
|
||||
|
@ -23,11 +23,18 @@ public interface FarmerContractMapper
|
||||
/**
|
||||
* 查询会员签约列表
|
||||
*
|
||||
* @param farmerContract 会员签约
|
||||
* @return 会员签约集合
|
||||
* @param farmerContract 会员合约
|
||||
* @return 会员合约集合
|
||||
*/
|
||||
public List<FarmerContract> selectFarmerContractList(FarmerContract farmerContract);
|
||||
|
||||
/**
|
||||
* 查询入驻会员合约的列表
|
||||
* @param farmerContract 会员合约
|
||||
* @return 会员合约集合
|
||||
*/
|
||||
public List<FarmerContract> selectEnterContractList(FarmerContract farmerContract);
|
||||
|
||||
/**
|
||||
* 新增会员签约
|
||||
*
|
||||
|
@ -19,6 +19,14 @@ public interface FarmerMapper
|
||||
*/
|
||||
public Farmer selectFarmerByFarmerId(Long farmerId);
|
||||
|
||||
/**
|
||||
* 查询带菜地信息的农场会员
|
||||
*
|
||||
* @param farmerId 农场会员主键
|
||||
* @return 农场会员
|
||||
*/
|
||||
public Farmer selectFarmerWithGardenById(Long farmerId);
|
||||
|
||||
/**
|
||||
* 查询农场会员列表
|
||||
*
|
||||
|
@ -30,6 +30,13 @@ public interface IFarmerContractService
|
||||
*/
|
||||
public List<FarmerContract> selectFarmerContractList(FarmerContract farmerContract);
|
||||
|
||||
/**
|
||||
* 查询入驻会员合约的列表
|
||||
* @param farmerContract 会员合约
|
||||
* @return 会员合约集合
|
||||
*/
|
||||
public List<FarmerContract> selectEnterContractList(FarmerContract farmerContract);
|
||||
|
||||
/**
|
||||
* 新增会员签约
|
||||
*
|
||||
|
@ -19,6 +19,14 @@ public interface IFarmerService
|
||||
*/
|
||||
public Farmer selectFarmerByFarmerId(Long farmerId);
|
||||
|
||||
/**
|
||||
* 查询带菜地信息的农场会员
|
||||
*
|
||||
* @param farmerId 农场会员主键
|
||||
* @return 农场会员
|
||||
*/
|
||||
public Farmer selectFarmerWithGardenById(Long farmerId);
|
||||
|
||||
/**
|
||||
* 查询农场会员列表
|
||||
*
|
||||
|
@ -57,7 +57,7 @@ public class FarmerContractServiceImpl implements IFarmerContractService
|
||||
}
|
||||
|
||||
// 合约不符合审核条件,返回错误提示
|
||||
if (!contract.getStatus().equals(DictUtils.getDictValue("csa_contract_status", "申请"))) {
|
||||
if (!contract.getStatus().equals(DictUtils.getDictValue("csa_contract_status", "待审"))) {
|
||||
throw new RuntimeException("该合约不符合审核条件!");
|
||||
}
|
||||
|
||||
@ -68,8 +68,8 @@ public class FarmerContractServiceImpl implements IFarmerContractService
|
||||
if (isNewFarmer) {
|
||||
// 如果是新签,新建地主信息
|
||||
farmer = new Farmer();
|
||||
farmer.setName("待绑定");
|
||||
farmer.setCoins(new BigDecimal(0));
|
||||
farmer.setName(contract.getContractor());
|
||||
farmer.setCoins(0L);
|
||||
farmer.setBalance(new BigDecimal(0));
|
||||
farmer.setWeight(new BigDecimal(0));
|
||||
farmer.setArchedYears(0L);
|
||||
@ -84,7 +84,7 @@ public class FarmerContractServiceImpl implements IFarmerContractService
|
||||
}
|
||||
|
||||
// 累计合约信息至地主,菜地有效期需要在绑定地块时处理
|
||||
farmer.setCoins(farmer.getCoins().add(contract.getCoins()));
|
||||
farmer.setCoins(farmer.getCoins() + contract.getCoins());
|
||||
farmer.setBalance(farmer.getBalance().add(contract.getBalance()));
|
||||
farmer.setWeight(farmer.getWeight().add(contract.getWeight()));
|
||||
farmer.setArchedYears(farmer.getArchedYears() + contract.getArchedYears());
|
||||
@ -92,7 +92,7 @@ public class FarmerContractServiceImpl implements IFarmerContractService
|
||||
// 构建审核的合约更新字段
|
||||
contract = new FarmerContract();
|
||||
contract.setContractId(contractId);
|
||||
contract.setStatus("2");
|
||||
contract.setStatus(DictUtils.getDictValue("csa_contract_status", "已审"));
|
||||
contract.setUpdateBy(getUsername());
|
||||
|
||||
if (isNewFarmer) {
|
||||
@ -126,11 +126,20 @@ public class FarmerContractServiceImpl implements IFarmerContractService
|
||||
* @return 会员签约
|
||||
*/
|
||||
@Override
|
||||
public List<FarmerContract> selectFarmerContractList(FarmerContract farmerContract)
|
||||
{
|
||||
public List<FarmerContract> selectFarmerContractList(FarmerContract farmerContract) {
|
||||
return farmerContractMapper.selectFarmerContractList(farmerContract);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询入驻会员合约的列表
|
||||
* @param farmerContract 会员合约
|
||||
* @return 会员合约集合
|
||||
*/
|
||||
@Override
|
||||
public List<FarmerContract> selectEnterContractList(FarmerContract farmerContract) {
|
||||
return farmerContractMapper.selectEnterContractList(farmerContract);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增会员签约
|
||||
*
|
||||
|
@ -32,6 +32,16 @@ public class FarmerServiceImpl implements IFarmerService
|
||||
return farmerMapper.selectFarmerByFarmerId(farmerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询带菜地信息的农场会员
|
||||
*
|
||||
* @param farmerId 农场会员主键
|
||||
* @return 农场会员
|
||||
*/
|
||||
public Farmer selectFarmerWithGardenById(Long farmerId) {
|
||||
return farmerMapper.selectFarmerWithGardenById(farmerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询农场会员列表
|
||||
*
|
||||
|
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="FarmerContract" id="FarmerContractResult">
|
||||
<result property="contractId" column="contract_id" />
|
||||
<result property="farmerId" column="farmer_id" />
|
||||
<result property="gardenId" column="garden_id" />
|
||||
<result property="contractor" column="contractor" />
|
||||
<result property="coins" column="coins" />
|
||||
<result property="balance" column="balance" />
|
||||
@ -26,10 +27,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="FarmerContract" id="ContractAndFarmerAndGardenResult" extends="FarmerContractResult">
|
||||
<association property="farmer" javaType="com.jlt.csa.domain.Farmer">
|
||||
<id property="farmerId" column="farmer_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="mobileNumber" column="mobile_number" />
|
||||
</association>
|
||||
<association property="garden" javaType="com.jlt.csa.domain.Garden">
|
||||
<id property="gardenId" column="garden_id" />
|
||||
<result property="code" column="code" />
|
||||
<result property="name" column="garden_name" />
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectFarmerContractVo">
|
||||
select contract_id, farmer_id, contractor, coins, balance, weight, arched_years, activate_way, join_credential_no, join_date, due_date, days, status, del_flag, create_by, create_time, update_by, update_time, remark from csa_farmer_contract
|
||||
select contract_id, farmer_id, garden_id, contractor, coins, balance, weight, arched_years, activate_way, join_credential_no, join_date, due_date, days, status, del_flag, create_by, create_time, update_by, update_time, remark from csa_farmer_contract
|
||||
</sql>
|
||||
|
||||
<sql id="selectContractAndFarmerAndGardenVo">
|
||||
select c.contract_id, c.farmer_id, c.garden_id, c.contractor, c.coins, c.balance, c.weight, c.arched_years,
|
||||
c.activate_way, c.join_credential_no, c.join_date, c.due_date, c.days, c.status,
|
||||
c.del_flag, c.create_by, c.create_time, c.update_by, c.update_time, c.remark,
|
||||
f.name, f.mobile_number,
|
||||
g.code, g.name as garden_name
|
||||
from csa_farmer_contract as c
|
||||
left join csa_farmer as f on c.farmer_id = f.farmer_id
|
||||
left join csa_garden as g on c.garden_id = g.garden_id
|
||||
</sql>
|
||||
|
||||
<select id="selectEnterContractList" parameterType="FarmerContract" resultMap="ContractAndFarmerAndGardenResult">
|
||||
<include refid="selectContractAndFarmerAndGardenVo" />
|
||||
<where>
|
||||
<if test="contractor != null and contractor != ''"> and c.contractor like concat('%', #{contractor}, '%')</if>
|
||||
<if test="joinDate != null "> and c.join_date = #{joinDate}</if>
|
||||
<if test="dueDate != null "> and c.due_date = #{dueDate}</if>
|
||||
<if test="status == null or status == ''"> and (c.status = '1' or c.status = '2')</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="delFlag == null or delFlag == ''"> and c.del_flag = '0'</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and c.del_flag = #{del_flag}</if>
|
||||
</where>
|
||||
order by contract_id DESC
|
||||
</select>
|
||||
|
||||
<select id="selectFarmerContractList" parameterType="FarmerContract" resultMap="FarmerContractResult">
|
||||
<include refid="selectFarmerContractVo"/>
|
||||
<where>
|
||||
@ -38,8 +77,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="dueDate != null "> and due_date = #{dueDate}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="delFlag == null or delFlag == ''"> and del_flag = '0'</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and status = #{status}</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag = #{del_flag}</if>
|
||||
</where>
|
||||
order by contract_id DESC
|
||||
</select>
|
||||
|
||||
<select id="selectFarmerContractByContractId" parameterType="Long" resultMap="FarmerContractResult">
|
||||
@ -51,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into csa_farmer_contract
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="farmerId != null">farmer_id,</if>
|
||||
<if test="gardenId != null">garden_id,</if>
|
||||
<if test="contractor != null and contractor != ''">contractor,</if>
|
||||
<if test="coins != null">coins,</if>
|
||||
<if test="balance != null">balance,</if>
|
||||
@ -71,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="farmerId != null">#{farmerId},</if>
|
||||
<if test="gardenId != null">#{gardenId},</if>
|
||||
<if test="contractor != null and contractor != ''">#{contractor},</if>
|
||||
<if test="coins != null">#{coins},</if>
|
||||
<if test="balance != null">#{balance},</if>
|
||||
@ -95,6 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update csa_farmer_contract
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="farmerId != null">farmer_id = #{farmerId},</if>
|
||||
<if test="gardenId != null">garden_id = #{gardenId},</if>
|
||||
<if test="contractor != null and contractor != ''">contractor = #{contractor},</if>
|
||||
<if test="coins != null">coins = #{coins},</if>
|
||||
<if test="balance != null">balance = #{balance},</if>
|
||||
|
@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="farmerId" column="farmer_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="gender" column="gender" />
|
||||
<result property="mobileNumber" column="mobile_umber" />
|
||||
<result property="coins" column="coins" />
|
||||
<result property="balance" column="balance" />
|
||||
<result property="weight" column="weight" />
|
||||
@ -24,14 +25,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="Farmer" id="FarmerWithGandenResult" extends="FarmerResult">
|
||||
<association property="garden" javaType="com.jlt.csa.domain.Garden">
|
||||
<id property="gardenId" column="garden_id" />
|
||||
<result property="code" column="code" />
|
||||
<result property="name" column="garden_name" />
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectFarmerVo">
|
||||
select farmer_id, name, gender, coins, balance, weight, arched_years, join_date, due_date, is_expire, status, del_flag, create_by, create_time, update_by, update_time, remark from csa_farmer
|
||||
select farmer_id, name, gender, coins, mobile_number, balance, weight, arched_years, join_date, due_date, is_expire, status, del_flag, create_by, create_time, update_by, update_time, remark from csa_farmer
|
||||
</sql>
|
||||
|
||||
<sql id="selectFarmerWithGardenVo">
|
||||
select f.farmer_id, f.name, f.gender, f.coins, f.mobile_number, f.balance, f.weight, f.arched_years,
|
||||
f.join_date, f.due_date, f.is_expire, f.status,
|
||||
f.del_flag, f.create_by, f.create_time, f.update_by, f.update_time, f.remark,
|
||||
g.garden_id, g.code, g.name as garden_name
|
||||
from csa_farmer f
|
||||
left join csa_garden g on f.farmer_id = g.farmer_id
|
||||
</sql>
|
||||
|
||||
<select id="selectFarmerList" parameterType="Farmer" resultMap="FarmerResult">
|
||||
<include refid="selectFarmerVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="mobileNumber != null and mobileNumber != ''"> and mobile_number = #{mobileNumber}</if>
|
||||
<if test="joinDate != null "> and join_date = #{joinDate}</if>
|
||||
<if test="dueDate != null "> and due_date = #{dueDate}</if>
|
||||
<if test="isExpire != null and isExpire != ''"> and is_expire = #{isExpire}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectFarmerWithGardenList" parameterType="Farmer" resultMap="FarmerWithGandenResult">
|
||||
<include refid="selectFarmerWithGardenVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="mobileNumber != null and mobileNumber != ''"> and mobile_number = #{mobileNumber}</if>
|
||||
<if test="joinDate != null "> and join_date = #{joinDate}</if>
|
||||
<if test="dueDate != null "> and due_date = #{dueDate}</if>
|
||||
<if test="isExpire != null and isExpire != ''"> and is_expire = #{isExpire}</if>
|
||||
@ -42,12 +72,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectFarmerVo"/>
|
||||
where farmer_id = #{farmerId}
|
||||
</select>
|
||||
|
||||
<select id="selectFarmerWithGardenById" parameterType="Long" resultMap="FarmerWithGandenResult">
|
||||
<include refid="selectFarmerWithGardenVo"/>
|
||||
where f.farmer_id = #{farmerId}
|
||||
</select>
|
||||
|
||||
<insert id="insertFarmer" parameterType="Farmer" useGeneratedKeys="true" keyProperty="farmerId">
|
||||
insert into csa_farmer
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="gender != null">gender,</if>
|
||||
<if test="mobileNumber != null">mobile_number,</if>
|
||||
<if test="coins != null">coins,</if>
|
||||
<if test="balance != null">balance,</if>
|
||||
<if test="weight != null">weight,</if>
|
||||
@ -66,6 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="gender != null">#{gender},</if>
|
||||
<if test="mobileNumber != null">#{mobileNumber},</if>
|
||||
<if test="coins != null">#{coins},</if>
|
||||
<if test="balance != null">#{balance},</if>
|
||||
<if test="weight != null">#{weight},</if>
|
||||
@ -88,6 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="gender != null">gender = #{gender},</if>
|
||||
<if test="mobileNumber != null">mobile_number = #{mobileNumber},</if>
|
||||
<if test="coins != null">coins = #{coins},</if>
|
||||
<if test="balance != null">balance = #{balance},</if>
|
||||
<if test="weight != null">weight = #{weight},</if>
|
||||
|
@ -5,12 +5,12 @@
|
||||
<mapper namespace="com.jlt.csa.mapper.GardenMapper">
|
||||
|
||||
<resultMap type="Garden" id="GardenResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="gardenId" column="garden_id" />
|
||||
<result property="zoneId" column="zone_id" />
|
||||
<result property="code" column="code" />
|
||||
<result property="name" column="name" />
|
||||
<result property="m2" column="m2" />
|
||||
<result property="memberId" column="member_id" />
|
||||
<result property="farmerId" column="farmer_id" />
|
||||
<result property="managerId" column="manager_id" />
|
||||
<result property="workerId" column="worker_id" />
|
||||
<result property="contacterId" column="contacter_id" />
|
||||
@ -31,7 +31,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGardenVo">
|
||||
select id, zone_id, code, name, m2, member_id, manager_id, worker_id, contacter_id, is_farming, is_selled, is_completed, status, del_flag, create_by, create_time, update_by, update_time, remark from csa_garden
|
||||
select garden_id, zone_id, code, name, m2, farmer_id, manager_id, worker_id, contacter_id, is_farming, is_selled, is_completed, status, del_flag, create_by, create_time, update_by, update_time, remark from csa_garden
|
||||
</sql>
|
||||
|
||||
<select id="getFarmZone" resultMap="com.jlt.csa.mapper.FarmZoneMapper.FarmZoneResult" parameterType="java.lang.Long">
|
||||
@ -42,10 +42,10 @@
|
||||
<include refid="selectGardenVo"/>
|
||||
<where>
|
||||
<if test="zoneId != null "> and zone_id = #{zoneId}</if>
|
||||
<if test="code != null and code != ''"> and code = #{code}</if>
|
||||
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="m2 != null "> and m2 = #{m2}</if>
|
||||
<if test="memberId != null "> and member_id = #{memberId}</if>
|
||||
<if test="farmerId != null "> and farmer_id = #{farmerId}</if>
|
||||
<if test="managerId != null "> and manager_id = #{managerId}</if>
|
||||
<if test="workerId != null "> and worker_id = #{workerId}</if>
|
||||
<if test="contacterId != null "> and contacter_id = #{contacterId}</if>
|
||||
@ -58,18 +58,17 @@
|
||||
|
||||
<select id="selectGardenById" parameterType="Long" resultMap="GardenResult">
|
||||
<include refid="selectGardenVo"/>
|
||||
where id = #{id}
|
||||
where garden_id = #{gardenId}
|
||||
</select>
|
||||
|
||||
<insert id="insertGarden" parameterType="Garden">
|
||||
insert into csa_garden
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="zoneId != null">zone_id,</if>
|
||||
<if test="code != null and code != ''">code,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="m2 != null">m2,</if>
|
||||
<if test="memberId != null">member_id,</if>
|
||||
<if test="farmerId != null">farmer_id,</if>
|
||||
<if test="managerId != null">manager_id,</if>
|
||||
<if test="workerId != null">worker_id,</if>
|
||||
<if test="contacterId != null">contacter_id,</if>
|
||||
@ -85,12 +84,11 @@
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="zoneId != null">#{zoneId},</if>
|
||||
<if test="code != null and code != ''">#{code},</if>
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="m2 != null">#{m2},</if>
|
||||
<if test="memberId != null">#{memberId},</if>
|
||||
<if test="farmerId != null">#{farmerId},</if>
|
||||
<if test="managerId != null">#{managerId},</if>
|
||||
<if test="workerId != null">#{workerId},</if>
|
||||
<if test="contacterId != null">#{contacterId},</if>
|
||||
@ -114,7 +112,7 @@
|
||||
<if test="code != null and code != ''">code = #{code},</if>
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="m2 != null">m2 = #{m2},</if>
|
||||
<if test="memberId != null">member_id = #{memberId},</if>
|
||||
<if test="farmerId != null">farmer_id = #{farmerId},</if>
|
||||
<if test="managerId != null">manager_id = #{managerId},</if>
|
||||
<if test="workerId != null">worker_id = #{workerId},</if>
|
||||
<if test="contacterId != null">contacter_id = #{contacterId},</if>
|
||||
@ -129,7 +127,7 @@
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
where garden_id = #{gardenId}
|
||||
</update>
|
||||
|
||||
<update id="updateGardenStatus">
|
||||
@ -143,20 +141,20 @@
|
||||
<if test="garden.updateBy != null">update_by = #{garden.updateBy},</if>
|
||||
<if test="garden.updateTime != null">update_time = #{garden.updateTime},</if>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
where garden_id in
|
||||
<foreach item="gardenId" collection="ids" open="(" separator="," close=")">
|
||||
#{gardenId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deleteGardenById" parameterType="Long">
|
||||
delete from csa_garden where id = #{id}
|
||||
delete from csa_garden where garden_id = #{gardenId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteGardenByIds" parameterType="String">
|
||||
delete from csa_garden where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
delete from csa_garden where garden_id in
|
||||
<foreach item="gardenId" collection="array" open="(" separator="," close=")">
|
||||
#{gardenId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Reference in New Issue
Block a user