新增套餐基本信息编辑功能,包括更新套餐名称和备注,支持客户筛选和绑定客户显示。
This commit is contained in:
@@ -34,8 +34,12 @@ public class PrcPriceSet extends BaseEntity
|
||||
|
||||
private Integer productCount;
|
||||
private Integer customerCount;
|
||||
/** List display: bound customer code/name summary (not a DB column). */
|
||||
private String boundCustomers;
|
||||
private Boolean expired;
|
||||
private String keyword;
|
||||
/** Query only: filter packages by bound customer id. */
|
||||
private Long customerId;
|
||||
private String submitFlag;
|
||||
/** current version on create/edit save */
|
||||
private PrcPriceSetVersion version;
|
||||
|
||||
@@ -21,6 +21,9 @@ public interface PrcPriceSetMapper
|
||||
|
||||
public int updatePrcPriceSet(PrcPriceSet set);
|
||||
|
||||
/** Update name / note only (does not touch set_type / discount / status). */
|
||||
public int updateBasicInfo(PrcPriceSet set);
|
||||
|
||||
public int updatePrcPriceSetStatus(PrcPriceSet set);
|
||||
|
||||
public int deletePrcPriceSetByIds(Long[] priceSetIds);
|
||||
|
||||
@@ -26,6 +26,9 @@ public interface IPrcPriceSetService
|
||||
|
||||
public int updatePrcPriceSet(PrcPriceSet set);
|
||||
|
||||
/** Update package name and note only; allowed for effect / draft / stopped. */
|
||||
public int updateBasicInfo(PrcPriceSet set);
|
||||
|
||||
public int deletePrcPriceSetByIds(Long[] priceSetIds);
|
||||
|
||||
public int submit(Long priceSetId, String updateBy);
|
||||
|
||||
+24
@@ -258,6 +258,30 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
return setMapper.updatePrcPriceSet(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateBasicInfo(PrcPriceSet set)
|
||||
{
|
||||
if (set == null || set.getPriceSetId() == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.set.notExists"));
|
||||
}
|
||||
PrcPriceSet db = requireSet(set.getPriceSetId());
|
||||
if (STATUS_AUDIT.equals(db.getStatus()))
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.set.edit.audit"));
|
||||
}
|
||||
if (StringUtils.isEmpty(set.getPriceSetName()))
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.set.name.empty"));
|
||||
}
|
||||
set.setPriceSetName(set.getPriceSetName().trim());
|
||||
if (setMapper.countByName(set) > 0)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.set.name.exists"));
|
||||
}
|
||||
return setMapper.updateBasicInfo(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int deletePrcPriceSetByIds(Long[] priceSetIds)
|
||||
|
||||
@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="productCount" column="product_count" />
|
||||
<result property="customerCount" column="customer_count" />
|
||||
<result property="boundCustomers" column="bound_customers" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcPriceSetVo">
|
||||
@@ -33,7 +34,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
inner join prc_price_set_version v on v.psv_id = p.psv_id
|
||||
where v.price_set_id = s.price_set_id
|
||||
and ifnull(p.is_del, '0') = '0') as product_count,
|
||||
(select count(1) from prc_customer_price_set c where c.price_set_id = s.price_set_id) as customer_count
|
||||
(select count(1) from prc_customer_price_set c where c.price_set_id = s.price_set_id) as customer_count,
|
||||
(select group_concat(
|
||||
concat(ifnull(c.customer_code, ''),
|
||||
case when ifnull(c.customer_name, '') = '' then '' else concat(' ', c.customer_name) end)
|
||||
order by c.bind_priority asc, c.customer_priceset_id asc
|
||||
separator '、')
|
||||
from prc_customer_price_set c
|
||||
where c.price_set_id = s.price_set_id) as bound_customers
|
||||
from prc_price_set s
|
||||
</sql>
|
||||
|
||||
@@ -47,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
s.set_type, s.default_discount, s.default_type, s.calculate_sign,
|
||||
s.status, s.tms_id,
|
||||
s.created_by, s.create_time, s.updated_by, s.update_time,
|
||||
null as product_count, null as customer_count
|
||||
null as product_count, null as customer_count, null as bound_customers
|
||||
from prc_price_set s
|
||||
where s.price_set_id = #{priceSetId}
|
||||
</select>
|
||||
@@ -71,14 +79,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND (
|
||||
s.price_set_code like concat('%', #{keyword}, '%')
|
||||
OR s.price_set_name like concat('%', #{keyword}, '%')
|
||||
OR exists (
|
||||
select 1 from prc_customer_price_set c
|
||||
where c.price_set_id = s.price_set_id
|
||||
and (
|
||||
c.customer_name like concat('%', #{keyword}, '%')
|
||||
or concat(c.customer_id, '') like concat('%', #{keyword}, '%')
|
||||
)
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="customerId != null">
|
||||
AND exists (
|
||||
select 1 from prc_customer_price_set c
|
||||
where c.price_set_id = s.price_set_id
|
||||
and c.customer_id = #{customerId}
|
||||
)
|
||||
</if>
|
||||
<!-- Data scope: customer sales / creator / explicit viewer bind.
|
||||
@@ -167,6 +174,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where price_set_id = #{priceSetId}
|
||||
</update>
|
||||
|
||||
<update id="updateBasicInfo" parameterType="PrcPriceSet">
|
||||
update prc_price_set
|
||||
<set>
|
||||
<if test="priceSetName != null and priceSetName != ''">price_set_name = #{priceSetName},</if>
|
||||
price_set_note = #{priceSetNote},
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where price_set_id = #{priceSetId}
|
||||
</update>
|
||||
|
||||
<update id="updatePrcPriceSetStatus" parameterType="PrcPriceSet">
|
||||
update prc_price_set
|
||||
<set>
|
||||
|
||||
Reference in New Issue
Block a user