手动审核,精确4位,社区组和社区人员除充值,已完成

This commit is contained in:
yuyang 2021-12-22 18:06:36 +08:00
parent 88e762c926
commit bb996d64c7
12 changed files with 496 additions and 25 deletions

View File

@ -29,6 +29,11 @@ public class LoginUser implements Serializable
*/ */
private String username; private String username;
/**
* 用户类型0 C端用户 1 流量方用户 2社区用户 3B端用户
*/
private Integer userType;
/** /**
* 登录时间 * 登录时间
*/ */
@ -148,4 +153,12 @@ public class LoginUser implements Serializable
{ {
this.sysUser = sysUser; this.sysUser = sysUser;
} }
public Integer getUserType() {
return userType;
}
public void setUserType(Integer userType) {
this.userType = userType;
}
} }

View File

@ -237,8 +237,8 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
DateTime parse = DateUtil.parse(DateUtil.format(startTime2, "yyyy-MM-dd"), "yyyy-MM-dd"); DateTime parse = DateUtil.parse(DateUtil.format(startTime2, "yyyy-MM-dd"), "yyyy-MM-dd");
DateTime parse1 = DateUtil.parse(DateUtil.format(updateTime2, "yyyy-MM-dd"), "yyyy-MM-dd"); DateTime parse1 = DateUtil.parse(DateUtil.format(updateTime2, "yyyy-MM-dd"), "yyyy-MM-dd");
//每分钟多少度电 //每分钟多少度电
BigDecimal decimal = new BigDecimal((updateTime2.getTime() - startTime2.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_DOWN); BigDecimal decimal = new BigDecimal((updateTime2.getTime() - startTime2.getTime())).divide(new BigDecimal(60000),4,BigDecimal.ROUND_DOWN);
BigDecimal divide = chargingDegree.divide(decimal,2,BigDecimal.ROUND_DOWN); BigDecimal divide = chargingDegree.divide(decimal,4,BigDecimal.ROUND_DOWN);
long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY); long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY);
if(betweenDay==0){ if(betweenDay==0){
powerPriceTotal = getBigDecimal(rateModelId,DateUtil.formatTime(startTime2), DateUtil.formatTime(updateTime2), powerPriceTotal, divide); powerPriceTotal = getBigDecimal(rateModelId,DateUtil.formatTime(startTime2), DateUtil.formatTime(updateTime2), powerPriceTotal, divide);
@ -834,14 +834,11 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
return powerPriceTotal; return powerPriceTotal;
} }
private BigDecimal getRateTimeList(String startTime, String endTime, BigDecimal degree, BigDecimal powerPrice) { private BigDecimal getRateTimeList(String startTime, String endTime, BigDecimal degree, BigDecimal powerPrice) {
System.out.println("startTime>>"+startTime);
System.out.println("endTime>>"+endTime);
long time = DateUtil.parse(endTime).getTime(); long time = DateUtil.parse(endTime).getTime();
long time1= DateUtil.parse(startTime).getTime(); long time1= DateUtil.parse(startTime).getTime();
BigDecimal multiply = new BigDecimal(time-time1).divide(new BigDecimal(60000),2, BigDecimal.ROUND_DOWN).multiply(degree).setScale(2,BigDecimal.ROUND_DOWN); BigDecimal multiply = new BigDecimal(time-time1).divide(new BigDecimal(60000),4, BigDecimal.ROUND_DOWN).multiply(degree).setScale(4,BigDecimal.ROUND_DOWN);
BigDecimal bigDecimal = multiply.multiply(powerPrice).setScale(2, BigDecimal.ROUND_DOWN); BigDecimal bigDecimal = multiply.multiply(powerPrice).setScale(2, BigDecimal.ROUND_DOWN);
System.out.println("bigDecimal>>"+bigDecimal);
return bigDecimal; return bigDecimal;
} }

View File

@ -5,6 +5,7 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.domain.XhpcChargingPile; import com.xhpc.common.domain.XhpcChargingPile;
import com.xhpc.user.domain.XhpcCommunity; import com.xhpc.user.domain.XhpcCommunity;
import com.xhpc.user.domain.XhpcCommunityPersonnel;
import com.xhpc.user.dto.MechanismDto; import com.xhpc.user.dto.MechanismDto;
import com.xhpc.user.service.IMechanismService; import com.xhpc.user.service.IMechanismService;
import com.xhpc.user.service.IXhpcCommunityService; import com.xhpc.user.service.IXhpcCommunityService;
@ -85,4 +86,60 @@ public class XhpcCommunityController extends BaseController {
return AjaxResult.success(mechanismDtos); return AjaxResult.success(mechanismDtos);
} }
/**
* 社区人员列表
*/
@GetMapping("/communityPersonnelList")
public TableDataInfo communityPersonnelList(Long communityId,String account,String phone,Integer status) {
startPage();
List<Map<String, Object>> list = xhpcCommunityService.communityPersonnelList(communityId, account, phone, status);
return getDataTable(list);
}
/**
* 社区人员添加
*
*/
@PostMapping(value = "/addCommunityPersonnel")
public AjaxResult addCommunityPersonnel(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) {
return xhpcCommunityService.addCommunityPersonnel(xhpcCommunityPersonnel);
}
/**
* 查看社区人员
*
*/
@PostMapping(value = "/getCommunityPersonnelById")
public AjaxResult getCommunityPersonnelById(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) {
return AjaxResult.success(xhpcCommunityService.getCommunityPersonnelById(xhpcCommunityPersonnel));
}
/**
* 编辑社区人员
*
*/
@PostMapping(value = "/updateCommunityPersonnel")
public AjaxResult updateCommunityPersonnel(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) {
return xhpcCommunityService.updateCommunityPersonnel(xhpcCommunityPersonnel);
}
/**
* 删除社区人员
*/
@PostMapping(value = "/deleteCommunityPersonnel")
public AjaxResult deleteCommunityPersonnel(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) {
xhpcCommunityService.deleteCommunityPersonnel(xhpcCommunityPersonnel);
return AjaxResult.success();
}
/**
* 删除社区人员
*/
@PostMapping(value = "/updateCommunityPersonnelStatus")
public AjaxResult updateCommunityPersonnelStatus(@RequestBody XhpcCommunityPersonnel xhpcCommunityPersonnel) {
xhpcCommunityService.updateCommunityPersonnelStatus(xhpcCommunityPersonnel);
return AjaxResult.success();
}
} }

View File

@ -0,0 +1,42 @@
package com.xhpc.user.domain;
import com.xhpc.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author yuyang
* @date 2021/12/22 15:33
*/
@Data
public class XhpcCommunityPersonnel extends BaseEntity {
private Long communityPersonnelId;
private Long communityId;
private String name;
private String account;
private BigDecimal rechargeMoney;
private BigDecimal consumeMoney;
private BigDecimal redPacket;
private BigDecimal surplusMoney;
private String phone;
private Integer type;
private Integer status;
private Integer delFlag;
/**
* 电站id
*/
private String chargingStationIds;
}

View File

@ -51,4 +51,14 @@ public interface MechanismMapper {
* @return 结果 * @return 结果
*/ */
public List<Map<String, Object>> dataChargingStationId(@Param("userId") Long userId, @Param("type") Integer type,@Param("operatorId") String operatorId,@Param("code") String cityCode); public List<Map<String, Object>> dataChargingStationId(@Param("userId") Long userId, @Param("type") Integer type,@Param("operatorId") String operatorId,@Param("code") String cityCode);
/**
* 删除该社区组的数据维度
*/
int updateMechanism(@Param("mechanismId")Long mechanismId,@Param("source")Integer source);
/**
* 添加数据维度
*/
int addMechanism(@Param("chargingStationIds") List<String> chargingStationIds,@Param("mechanismId")Long mechanismId,@Param("source")Integer source);
} }

View File

@ -1,6 +1,7 @@
package com.xhpc.user.mapper; package com.xhpc.user.mapper;
import com.xhpc.user.domain.XhpcCommunity; import com.xhpc.user.domain.XhpcCommunity;
import com.xhpc.user.domain.XhpcCommunityPersonnel;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -21,11 +22,6 @@ public interface XhpcCommunityMapper {
*/ */
List<Map<String, Object>> list(@Param("name") String name); List<Map<String, Object>> list(@Param("name") String name);
/**
* 添加数据维度
*/
int addMechanism(@Param("chargingStationIds") List<String> chargingStationIds,@Param("mechanismId")Long mechanismId,@Param("source")Integer source);
/** /**
* 添加社区组 * 添加社区组
* @param xhpcCommunity * @param xhpcCommunity
@ -40,7 +36,7 @@ public interface XhpcCommunityMapper {
*/ */
int updateCommunity(XhpcCommunity xhpcCommunity); int updateCommunity(XhpcCommunity xhpcCommunity);
/** /**
* 社区社区组 * 删除社区社区组
* @param communityId * @param communityId
*/ */
void deleteCommunity(@Param("communityId")Long communityId); void deleteCommunity(@Param("communityId")Long communityId);
@ -59,4 +55,42 @@ public interface XhpcCommunityMapper {
* @return * @return
*/ */
Map<String, Object> getCommunityById(@Param("communityId")Long communityId,@Param("name")String name,@Param("type")Integer type); Map<String, Object> getCommunityById(@Param("communityId")Long communityId,@Param("name")String name,@Param("type")Integer type);
/**
* 社区人员列表
* @return
*/
List<Map<String, Object>> communityPersonnelList(@Param("communityId")Long communityId,@Param("account")String account,@Param("phone")String phone,@Param("status")Integer status);
/**
* 添加社区人员
* @param xhpcCommunityPersonnel
* @return
*/
int addCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel);
/**
* 查询社区人员
* @return
*/
Map<String, Object> getCommunityPersonnelById(@Param("communityPersonnelId")Long communityPersonnelId,@Param("phone")String phone,@Param("account")String account,@Param("type")Integer type);
/**
* 修改社区人员
* @return
*/
int updateCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel);
/**
* 删除社区社人员
* @param communityPersonnelId
*/
void deleteCommunityPersonnel(@Param("communityPersonnelId")Long communityPersonnelId);
/**
* 社区人员状态改变
*/
void updateCommunityPersonnelStatus(@Param("communityPersonnelId")Long communityPersonnelId,@Param("status")Integer status);
} }

View File

@ -17,4 +17,14 @@ public interface IMechanismService {
* @return 结果 * @return 结果
*/ */
public List<MechanismDto> dataList(Integer status); public List<MechanismDto> dataList(Integer status);
/**
* 删除该社区组的数据维度
*/
int updateMechanism(Long mechanismId,Integer source);
/**
* 添加数据维度
*/
int addMechanism(List<String> chargingStationIds,Long mechanismId,Integer source);
} }

View File

@ -3,6 +3,7 @@ package com.xhpc.user.service;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcChargingPile; import com.xhpc.common.domain.XhpcChargingPile;
import com.xhpc.user.domain.XhpcCommunity; import com.xhpc.user.domain.XhpcCommunity;
import com.xhpc.user.domain.XhpcCommunityPersonnel;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -48,4 +49,42 @@ public interface IXhpcCommunityService {
*/ */
Map<String, Object> getCommunityById(XhpcCommunity xhpcCommunity); Map<String, Object> getCommunityById(XhpcCommunity xhpcCommunity);
/**
* 社区人员列表
* @return
*/
List<Map<String, Object>> communityPersonnelList(Long communityId,String account,String phone,Integer status);
/**
* 新增社区人员
* @param
* @return
*/
AjaxResult addCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel);
/**
* 查询社区人员
*
* @return
*/
Map<String, Object> getCommunityPersonnelById(XhpcCommunityPersonnel xhpcCommunityPersonnel);
/**
* 编辑社区组树
*
* @param
* @return
*/
AjaxResult updateCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel);
/**
* 删除社区人员
*/
void deleteCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel);
/**
* 社区人员状态改变
*/
void updateCommunityPersonnelStatus(XhpcCommunityPersonnel xhpcCommunityPersonnel);
} }

View File

@ -53,6 +53,16 @@ public class IMechanismServiceImpl implements IMechanismService {
} }
} }
@Override
public int updateMechanism(Long mechanismId, Integer source) {
return mechanismMapper.updateMechanism(mechanismId, source);
}
@Override
public int addMechanism(List<String> chargingStationIds, Long mechanismId, Integer source) {
return mechanismMapper.addMechanism(chargingStationIds, mechanismId, source);
}
/** /**
* 地区树 * 地区树

View File

@ -3,7 +3,9 @@ package com.xhpc.user.service.impl;
import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.user.domain.XhpcCommunity; import com.xhpc.user.domain.XhpcCommunity;
import com.xhpc.user.domain.XhpcCommunityPersonnel;
import com.xhpc.user.mapper.XhpcCommunityMapper; import com.xhpc.user.mapper.XhpcCommunityMapper;
import com.xhpc.user.service.IMechanismService;
import com.xhpc.user.service.IXhpcCommunityService; import com.xhpc.user.service.IXhpcCommunityService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -22,6 +24,8 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
@Autowired @Autowired
private XhpcCommunityMapper xhpcCommunityMapper; private XhpcCommunityMapper xhpcCommunityMapper;
@Autowired
private IMechanismService mechanismService;
@Override @Override
public List<Map<String, Object>> list(String name) { public List<Map<String, Object>> list(String name) {
@ -55,7 +59,7 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
} }
xhpcCommunityMapper.addCommunity(xhpcCommunity); xhpcCommunityMapper.addCommunity(xhpcCommunity);
if(!"".equals(chargingStationIds) && chargingStationIds !=null){ if(!"".equals(chargingStationIds) && chargingStationIds !=null){
xhpcCommunityMapper.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCommunity.getCommunityId(),0); mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCommunity.getCommunityId(),0);
} }
return AjaxResult.success(); return AjaxResult.success();
} }
@ -84,9 +88,10 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
}else{ }else{
xhpcCommunity.setStatus(1); xhpcCommunity.setStatus(1);
} }
xhpcCommunityMapper.addCommunity(xhpcCommunity); xhpcCommunityMapper.updateCommunity(xhpcCommunity);
mechanismService.updateMechanism(xhpcCommunity.getCommunityId(),0);
if(!"".equals(chargingStationIds) && chargingStationIds !=null){ if(!"".equals(chargingStationIds) && chargingStationIds !=null){
xhpcCommunityMapper.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCommunity.getCommunityId(),0); mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCommunity.getCommunityId(),0);
} }
return AjaxResult.success(); return AjaxResult.success();
} }
@ -96,4 +101,63 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
return xhpcCommunityMapper.getCommunityById(xhpcCommunity.getCommunityId(),null,1); return xhpcCommunityMapper.getCommunityById(xhpcCommunity.getCommunityId(),null,1);
} }
@Override
public List<Map<String, Object>> communityPersonnelList(Long communityId, String account, String phone, Integer status) {
return xhpcCommunityMapper.communityPersonnelList(communityId, account, phone, status);
}
@Override
public AjaxResult addCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel) {
String phone = xhpcCommunityPersonnel.getPhone();
String account = xhpcCommunityPersonnel.getAccount();
Map<String, Object> communityPersonnelById = xhpcCommunityMapper.getCommunityPersonnelById(null, phone, account, 3);
if(communityPersonnelById !=null){
if(phone.equals(communityPersonnelById.get("phone").toString())){
return AjaxResult.error("手机号重复");
}
if(account.equals(communityPersonnelById.get("account").toString())){
return AjaxResult.error("账号重复");
}
}
xhpcCommunityMapper.addCommunityPersonnel(xhpcCommunityPersonnel);
//增加一条充值记录
return AjaxResult.success();
}
@Override
public Map<String, Object> getCommunityPersonnelById(XhpcCommunityPersonnel xhpcCommunityPersonnel) {
return xhpcCommunityMapper.getCommunityPersonnelById(xhpcCommunityPersonnel.getCommunityPersonnelId(), null, null, 1);
}
@Override
public AjaxResult updateCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel) {
Long communityPersonnelId = xhpcCommunityPersonnel.getCommunityPersonnelId();
String phone = xhpcCommunityPersonnel.getPhone();
String account = xhpcCommunityPersonnel.getAccount();
Map<String, Object> communityPersonnelById = xhpcCommunityMapper.getCommunityPersonnelById(communityPersonnelId, phone, account, 2);
if(communityPersonnelById !=null){
if(phone.equals(communityPersonnelById.get("phone").toString())){
return AjaxResult.error("手机号重复");
}
if(account.equals(communityPersonnelById.get("account").toString())){
return AjaxResult.error("账号重复");
}
}
xhpcCommunityMapper.updateCommunityPersonnel(xhpcCommunityPersonnel);
return AjaxResult.success();
}
@Override
public void deleteCommunityPersonnel(XhpcCommunityPersonnel xhpcCommunityPersonnel) {
xhpcCommunityMapper.deleteCommunityPersonnel(xhpcCommunityPersonnel.getCommunityPersonnelId());
}
@Override
public void updateCommunityPersonnelStatus(XhpcCommunityPersonnel xhpcCommunityPersonnel) {
xhpcCommunityMapper.updateCommunityPersonnelStatus(xhpcCommunityPersonnel.getCommunityPersonnelId(),xhpcCommunityPersonnel.getStatus());
}
} }

View File

@ -128,4 +128,14 @@
and xcs.area_code = #{code} and xcs.area_code = #{code}
</if> </if>
</select> </select>
<update id="updateMechanism">
update xhpc_mechanism set del_flag =1 where mechanism_id=#{mechanismId} and source=#{source }
</update>
<insert id="addMechanism">
insert into xhpc_mechanism (charging_station_id,mechanism_id,source) VALUES
<foreach collection="chargingStationIds" item="item" open="(" separator="),(" close=")">
#{item},#{mechanismId},#{source}
</foreach>
</insert>
</mapper> </mapper>

View File

@ -39,13 +39,6 @@
</if> </if>
</select> </select>
<insert id="addMechanism">
insert into xhpc_mechanism (charging_station_id,mechanism_id,source) VALUES
<foreach collection="chargingStationIds" item="item" open="(" separator="),(" close=")">
#{item},#{mechanismId},#{source}
</foreach>
</insert>
<insert id="addCommunity" parameterType="com.xhpc.user.domain.XhpcCommunity" useGeneratedKeys="true" keyProperty="communityId"> <insert id="addCommunity" parameterType="com.xhpc.user.domain.XhpcCommunity" useGeneratedKeys="true" keyProperty="communityId">
insert into xhpc_community insert into xhpc_community
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -170,7 +163,7 @@
</update> </update>
<select id="countCommunityPersonnel" resultType="java.lang.Integer"> <select id="countCommunityPersonnel" resultType="java.lang.Integer">
select count (community_personnel_id) from xhpc_community_personnel where community_id=#{communityId} and del_flag=0 select count(community_personnel_id) from xhpc_community_personnel where community_id=#{communityId} and del_flag=0
</select> </select>
<select id="getCommunityById" resultType="map"> <select id="getCommunityById" resultType="map">
@ -186,7 +179,7 @@
co.status as status, co.status as status,
group_concat(me.charging_station_id) chargingStationIds group_concat(me.charging_station_id) chargingStationIds
from xhpc_community co from xhpc_community co
left join xhpc_mechanism me on me.mechanism_id = co.community_id and me.source = 0 left join xhpc_mechanism me on me.mechanism_id = co.community_id and me.source = 0 and me.del_flag =0
where 1=1 where 1=1
<if test="communityId !=null and type !=null and type==1"> <if test="communityId !=null and type !=null and type==1">
and co.community_id=#{communityId} and co.community_id=#{communityId}
@ -200,4 +193,196 @@
limit 1 limit 1
</select> </select>
<select id="communityPersonnelList" resultType="map">
SELECT
community_personnel_id AS communityPersonnelId,
name AS name,
community_id AS communityId,
account AS account,
phone AS phone,
recharge_money AS rechargeMoney,
consume_money AS consumeMoney,
red_packet AS redPacket,
surplus_money AS surplusMoney,
type,
status
FROM
xhpc_community_personnel
where community_id=#{communityId} and del_flag=0
<if test="account !=null and account !=''">
and account like concat(concat('%', #{account}), '%')
</if>
<if test="phone !=null and phone !=''">
and phone like concat(concat('%', #{phone}), '%')
</if>
<if test="status !=null">
and status=#{status}
</if>
</select>
<insert id="addCommunityPersonnel" parameterType="com.xhpc.user.domain.XhpcCommunityPersonnel" useGeneratedKeys="true" keyProperty="communityPersonnelId">
insert into xhpc_community_personnel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != communityPersonnelId">
community_personnel_id,
</if>
<if test="null != communityId">
community_id,
</if>
<if test="null != name and '' != name">
name,
</if>
<if test="null != account">
account,
</if>
<if test="null != rechargeMoney">
recharge_money,
</if>
<if test="null != consumeMoney">
consume_money,
</if>
<if test="null != redPacket">
red_packet,
</if>
<if test="null != surplusMoney">
surplus_money,
</if>
<if test="null != phone">
phone,
</if>
<if test="null != type">
type,
</if>
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != communityPersonnelId">
#{communityPersonnelId},
</if>
<if test="null != communityId">
#{communityId},
</if>
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != account">
#{account},
</if>
<if test="null != rechargeMoney">
#{rechargeMoney},
</if>
<if test="null != consumeMoney">
#{consumeMoney},
</if>
<if test="null != redPacket">
#{redPacket},
</if>
<if test="null != surplusMoney">
#{surplusMoney},
</if>
<if test="null != phone">
#{phone},
</if>
<if test="null != type">
#{type},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
</trim>
</insert>
<select id="getCommunityPersonnelById" resultType="map">
select
community_personnel_id AS communityPersonnelId,
name AS name,
community_id AS communityId,
account AS account,
phone AS phone,
recharge_money AS rechargeMoney,
type,
status
from xhpc_community_personnel
where del_flag =0
<if test="communityPersonnelId !=null and type !=null and type==1">
and community_personnel_id=#{communityPersonnelId}
</if>
<if test="type !=null and type==3">
and phone =#{phone} or account =#{account}
</if>
<if test="communityPersonnelId !=null and type !=null and type==2">
and community_personnel_id !=#{communityPersonnelId}
and community_personnel_id in ( select community_personnel_id from xhpc_community_personnel where phone =#{phone} or account =#{account} and del_flag =0)
</if>
limit 1
</select>
<update id="updateCommunityPersonnel">
update xhpc_community_personnel
<trim prefix="SET" suffixOverrides=",">
<if test="communityId != null">community_id = #{communityId},</if>
<if test="name != null">name = #{name},</if>
<if test="account != null">account = #{account},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="type != null">type = #{type},</if>
<if test="status != null">address = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where community_personnel_id=#{communityPersonnelId}
</update>
<update id="deleteCommunityPersonnel">
update xhpc_community_personnel set del_flag=1 where community_personnel_id=#{communityPersonnelId}
</update>
<update id="updateCommunityPersonnelStatus">
update xhpc_community_personnel set status=#{status} where community_personnel_id=#{communityPersonnelId}
</update>
</mapper> </mapper>