mirror of https://github.com/jeecgboot/jeecg-boot
feat: extra fee entities and CRUD
parent
40b1e6e1a0
commit
70a0805032
|
@ -0,0 +1,163 @@
|
|||
package org.jeecg.modules.business.controller.admin;
|
||||
|
||||
import java.util.Arrays;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.business.entity.BillingOptions;
|
||||
import org.jeecg.modules.business.service.IBillingOptionsService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: billing options
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-10-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="billing options")
|
||||
@RestController
|
||||
@RequestMapping("/billingOptions")
|
||||
@Slf4j
|
||||
public class BillingOptionsController extends JeecgController<BillingOptions, IBillingOptionsService> {
|
||||
@Autowired
|
||||
private IBillingOptionsService billingOptionsService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param billingOptions
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "billing options-分页列表查询")
|
||||
@ApiOperation(value="billing options-分页列表查询", notes="billing options-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<BillingOptions>> queryPageList(BillingOptions billingOptions,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<BillingOptions> queryWrapper = QueryGenerator.initQueryWrapper(billingOptions, req.getParameterMap());
|
||||
Page<BillingOptions> page = new Page<BillingOptions>(pageNo, pageSize);
|
||||
IPage<BillingOptions> pageList = billingOptionsService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param billingOptions
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "billing options-添加")
|
||||
@ApiOperation(value="billing options-添加", notes="billing options-添加")
|
||||
@RequiresPermissions("business:billing_options:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody BillingOptions billingOptions) {
|
||||
billingOptionsService.save(billingOptions);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param billingOptions
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "billing options-编辑")
|
||||
@ApiOperation(value="billing options-编辑", notes="billing options-编辑")
|
||||
@RequiresPermissions("business:billing_options:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody BillingOptions billingOptions) {
|
||||
billingOptionsService.updateById(billingOptions);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "billing options-通过id删除")
|
||||
@ApiOperation(value="billing options-通过id删除", notes="billing options-通过id删除")
|
||||
@RequiresPermissions("business:billing_options:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
billingOptionsService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "billing options-批量删除")
|
||||
@ApiOperation(value="billing options-批量删除", notes="billing options-批量删除")
|
||||
@RequiresPermissions("business:billing_options:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.billingOptionsService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "billing options-通过id查询")
|
||||
@ApiOperation(value="billing options-通过id查询", notes="billing options-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<BillingOptions> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
BillingOptions billingOptions = billingOptionsService.getById(id);
|
||||
if(billingOptions==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(billingOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param billingOptions
|
||||
*/
|
||||
@RequiresPermissions("business:billing_options:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, BillingOptions billingOptions) {
|
||||
return super.exportXls(request, billingOptions, BillingOptions.class, "billing options");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("business:billing_options:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, BillingOptions.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,237 @@
|
|||
package org.jeecg.modules.business.controller.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.business.entity.ExtraFee;
|
||||
import org.jeecg.modules.business.entity.ExtraFeeOption;
|
||||
import org.jeecg.modules.business.service.IExtraFeeOptionService;
|
||||
import org.jeecg.modules.business.service.IExtraFeeService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.business.service.IShopService;
|
||||
import org.jeecg.modules.business.vo.ExtraFeeParam;
|
||||
import org.jeecg.modules.business.vo.ExtraFeeResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
import static org.jeecg.common.util.SqlInjectionUtil.specialFilterContentForDictSql;
|
||||
|
||||
/**
|
||||
* @Description: extra fee content
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-11-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="extra fee content")
|
||||
@RestController
|
||||
@RequestMapping("/extraFee")
|
||||
@Slf4j
|
||||
public class ExtraFeeController extends JeecgController<ExtraFee, IExtraFeeService> {
|
||||
@Autowired
|
||||
private IExtraFeeService extraFeeService;
|
||||
@Autowired
|
||||
private IExtraFeeOptionService extraFeeOptionService;
|
||||
@Autowired
|
||||
private IShopService shopService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param pageNo page number
|
||||
* @param pageSize page size
|
||||
* @param column column to order by
|
||||
* @param order result order
|
||||
* @param shop shop code
|
||||
* @param statuses fee status
|
||||
* @return result
|
||||
*/
|
||||
//@AutoLog(value = "extra fee content-分页列表查询")
|
||||
@ApiOperation(value="extra fee content-分页列表查询", notes="extra fee content-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<ExtraFeeResult>> listWithFilters(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "column", defaultValue = "create_time") String column,
|
||||
@RequestParam(name = "order", defaultValue = "DESC") String order,
|
||||
@RequestParam(name = "shop", required = false) String shop,
|
||||
@RequestParam(name = "status", required = false) String statuses
|
||||
) {
|
||||
String parsedColumn = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, column.replace("_dictText", ""));
|
||||
String parsedOrder = order.toUpperCase();
|
||||
if(!parsedOrder.equals("ASC") && !parsedOrder.equals("DESC")) {
|
||||
return Result.error("Error 400 Bad Request");
|
||||
}
|
||||
try {
|
||||
specialFilterContentForDictSql(parsedColumn);
|
||||
} catch (RuntimeException e) {
|
||||
return Result.error("Error 400 Bad Request");
|
||||
}
|
||||
List<String> statusList = new ArrayList<>();
|
||||
if(statuses != null)
|
||||
statusList = Arrays.asList(statuses.split(","));
|
||||
String status = null;
|
||||
if(statusList.size() == 1) {
|
||||
status = statusList.get(0);
|
||||
}
|
||||
int total = extraFeeService.countAllFees(shop, status);
|
||||
List<ExtraFeeResult> extraFeeResults = extraFeeService.listWithFilters(shop, status, pageNo, pageSize, parsedColumn, parsedOrder);
|
||||
|
||||
IPage<ExtraFeeResult> page = new Page<>();
|
||||
page.setRecords(extraFeeResults);
|
||||
page.setCurrent(pageNo);
|
||||
page.setSize(pageSize);
|
||||
page.setTotal(total);
|
||||
|
||||
return Result.OK(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param extraFees
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "extra fee content-添加")
|
||||
@ApiOperation(value="extra fee content-添加", notes="extra fee content-添加")
|
||||
@RequiresPermissions("business:extra_fee:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ExtraFee extraFees) {
|
||||
extraFeeService.save(extraFees);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param extraFees
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "extra fee content-编辑")
|
||||
@ApiOperation(value="extra fee content-编辑", notes="extra fee content-编辑")
|
||||
@RequiresPermissions("business:extra_fee:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ExtraFee extraFees) {
|
||||
extraFeeService.updateById(extraFees);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "extra fee content-通过id删除")
|
||||
@ApiOperation(value="extra fee content-通过id删除", notes="extra fee content-通过id删除")
|
||||
@RequiresPermissions("business:extra_fee:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
extraFeeService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "extra fee content-批量删除")
|
||||
@ApiOperation(value="extra fee content-批量删除", notes="extra fee content-批量删除")
|
||||
@RequiresPermissions("business:extra_fee:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.extraFeeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "extra fee content-通过id查询")
|
||||
@ApiOperation(value="extra fee content-通过id查询", notes="extra fee content-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<ExtraFee> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
ExtraFee extraFees = extraFeeService.getById(id);
|
||||
if(extraFees==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(extraFees);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param extraFees
|
||||
*/
|
||||
@RequiresPermissions("business:extra_fee:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ExtraFee extraFees) {
|
||||
return super.exportXls(request, extraFees, ExtraFee.class, "extra fee content");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("business:extra_fee:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ExtraFee.class);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/create")
|
||||
public Result<?> create(@RequestBody ExtraFeeParam feeParam) {
|
||||
String autresOptionName = "Autres";
|
||||
ExtraFeeOption option = extraFeeOptionService.getById(feeParam.getOptionId());
|
||||
String shopId = shopService.getIdByCode(feeParam.getShop());
|
||||
if(shopId == null) {
|
||||
return Result.error(404, "Shop not found");
|
||||
}
|
||||
if(option == null) {
|
||||
return Result.error(404, "Option not found");
|
||||
}
|
||||
ExtraFeeOption otherOption = extraFeeOptionService.getByName(autresOptionName);
|
||||
if(option.getId().equals(otherOption.getId())) {
|
||||
if(feeParam.getDescription().isEmpty())
|
||||
return Result.error(403, "Description is empty");
|
||||
} else {
|
||||
feeParam.setDescription(null);
|
||||
}
|
||||
ExtraFee fee = new ExtraFee();
|
||||
fee.setShop_id(shopId);
|
||||
fee.setOptionId(feeParam.getOptionId());
|
||||
fee.setDescription(feeParam.getDescription());
|
||||
fee.setQuantity(feeParam.getQuantity());
|
||||
fee.setUnitPrice(feeParam.getUnitPrice());
|
||||
extraFeeService.save(fee);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/update")
|
||||
public Result<?> update(@RequestBody ExtraFeeParam feeParam) throws Exception {
|
||||
extraFeeService.updateFee(feeParam);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
package org.jeecg.modules.business.controller.admin;
|
||||
|
||||
import java.util.Arrays;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.business.entity.ExtraFeeOption;
|
||||
import org.jeecg.modules.business.service.IExtraFeeOptionService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: extra fee option
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-11-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="extra fee option")
|
||||
@RestController
|
||||
@RequestMapping("/extraFeeOption")
|
||||
@Slf4j
|
||||
public class ExtraFeeOptionController extends JeecgController<ExtraFeeOption, IExtraFeeOptionService> {
|
||||
@Autowired
|
||||
private IExtraFeeOptionService ExtraFeeOptionService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param ExtraFeeOption
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "extra fee option-分页列表查询")
|
||||
@ApiOperation(value="extra fee option-分页列表查询", notes="extra fee option-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<ExtraFeeOption>> queryPageList(ExtraFeeOption ExtraFeeOption,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<ExtraFeeOption> queryWrapper = QueryGenerator.initQueryWrapper(ExtraFeeOption, req.getParameterMap());
|
||||
Page<ExtraFeeOption> page = new Page<ExtraFeeOption>(pageNo, pageSize);
|
||||
IPage<ExtraFeeOption> pageList = ExtraFeeOptionService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param ExtraFeeOption
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "extra fee option-添加")
|
||||
@ApiOperation(value="extra fee option-添加", notes="extra fee option-添加")
|
||||
@RequiresPermissions("business:extra_fee_option:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ExtraFeeOption ExtraFeeOption) {
|
||||
ExtraFeeOptionService.save(ExtraFeeOption);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param ExtraFeeOption
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "extra fee option-编辑")
|
||||
@ApiOperation(value="extra fee option-编辑", notes="extra fee option-编辑")
|
||||
@RequiresPermissions("business:extra_fee_option:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ExtraFeeOption ExtraFeeOption) {
|
||||
ExtraFeeOptionService.updateById(ExtraFeeOption);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "extra fee option-通过id删除")
|
||||
@ApiOperation(value="extra fee option-通过id删除", notes="extra fee option-通过id删除")
|
||||
@RequiresPermissions("business:extra_fee_option:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
ExtraFeeOptionService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "extra fee option-批量删除")
|
||||
@ApiOperation(value="extra fee option-批量删除", notes="extra fee option-批量删除")
|
||||
@RequiresPermissions("business:extra_fee_option:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.ExtraFeeOptionService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "extra fee option-通过id查询")
|
||||
@ApiOperation(value="extra fee option-通过id查询", notes="extra fee option-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<ExtraFeeOption> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
ExtraFeeOption ExtraFeeOption = ExtraFeeOptionService.getById(id);
|
||||
if(ExtraFeeOption==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(ExtraFeeOption);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param ExtraFeeOption
|
||||
*/
|
||||
@RequiresPermissions("business:extra_fee_option:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ExtraFeeOption ExtraFeeOption) {
|
||||
return super.exportXls(request, ExtraFeeOption, ExtraFeeOption.class, "extra fee option");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("business:extra_fee_option:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ExtraFeeOption.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,167 @@
|
|||
package org.jeecg.modules.business.controller.admin;
|
||||
|
||||
import java.util.Arrays;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.business.entity.Shop;
|
||||
import org.jeecg.modules.business.service.IShopService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: shop
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-11-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="shop")
|
||||
@RestController
|
||||
@RequestMapping("/shop")
|
||||
@Slf4j
|
||||
public class ShopController extends JeecgController<Shop, IShopService> {
|
||||
@Autowired
|
||||
private IShopService shopService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param shop
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "shop-分页列表查询")
|
||||
@ApiOperation(value="shop-分页列表查询", notes="shop-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Shop>> queryPageList(Shop shop,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Shop> queryWrapper = QueryGenerator.initQueryWrapper(shop, req.getParameterMap());
|
||||
Page<Shop> page = new Page<Shop>(pageNo, pageSize);
|
||||
IPage<Shop> pageList = shopService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param shop
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "shop-添加")
|
||||
@ApiOperation(value="shop-添加", notes="shop-添加")
|
||||
@RequiresPermissions("shop:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Shop shop) {
|
||||
shopService.save(shop);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param shop
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "shop-编辑")
|
||||
@ApiOperation(value="shop-编辑", notes="shop-编辑")
|
||||
@RequiresPermissions("shop:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Shop shop) {
|
||||
shopService.updateById(shop);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "shop-通过id删除")
|
||||
@ApiOperation(value="shop-通过id删除", notes="shop-通过id删除")
|
||||
@RequiresPermissions("shop:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
shopService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "shop-批量删除")
|
||||
@ApiOperation(value="shop-批量删除", notes="shop-批量删除")
|
||||
@RequiresPermissions("shop:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.shopService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "shop-通过id查询")
|
||||
@ApiOperation(value="shop-通过id查询", notes="shop-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Shop> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Shop shop = shopService.getById(id);
|
||||
if(shop==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(shop);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param shop
|
||||
*/
|
||||
@RequiresPermissions("shop:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Shop shop) {
|
||||
return super.exportXls(request, shop, Shop.class, "shop");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("shop:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, Shop.class);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/shopGroupedByClient")
|
||||
public Result<?> listShopGroupedByClient() {
|
||||
return Result.OK(shopService.listShopGroupedByClient());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package org.jeecg.modules.business.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: billing options
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-10-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("billing_options")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="billing_options对象", description="billing options")
|
||||
public class BillingOptions implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**是否开全部票*/
|
||||
@Excel(name = "是否开全部票", width = 15)
|
||||
@ApiModelProperty(value = "是否开全部票")
|
||||
private java.lang.Integer isComplete;
|
||||
/**is preshipping or postshipping*/
|
||||
@Excel(name = "is preshipping or postshipping", width = 15)
|
||||
@ApiModelProperty(value = "is preshipping or postshipping")
|
||||
private java.lang.Integer isPre;
|
||||
/**automatic billing or manual*/
|
||||
@Excel(name = "automatic billing or manual", width = 15)
|
||||
@ApiModelProperty(value = "automatic billing or manual")
|
||||
private java.lang.Integer isAutomatic;
|
||||
/**shop id*/
|
||||
@Excel(name = "shop id", width = 15, dictTable = "shop", dicText = "erp_code", dicCode = "id")
|
||||
@Dict(dictTable = "shop", dicText = "erp_code", dicCode = "id")
|
||||
@ApiModelProperty(value = "shop id")
|
||||
private java.lang.String shopId;
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package org.jeecg.modules.business.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: extra fees content
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-11-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("extra_fee")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="extra_fee对象", description="extra fee content")
|
||||
public class ExtraFee implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**shop erpCode*/
|
||||
@Excel(name = "shop ID", width = 15)
|
||||
@ApiModelProperty(value = "shop_id")
|
||||
private java.lang.String shop_id;
|
||||
/**option_id*/
|
||||
@Excel(name = "option_id", width = 15)
|
||||
@ApiModelProperty(value = "option_id")
|
||||
private java.lang.String optionId;
|
||||
/**数量*/
|
||||
@Excel(name = "数量", width = 15)
|
||||
@ApiModelProperty(value = "数量")
|
||||
private java.lang.Integer quantity;
|
||||
/**price per unit*/
|
||||
@Excel(name = "price per unit", width = 15)
|
||||
@ApiModelProperty(value = "price per unit")
|
||||
private java.math.BigDecimal unitPrice;
|
||||
/**Précision pour les champs "autres"*/
|
||||
@Excel(name = "description for others", width = 15)
|
||||
@ApiModelProperty(value = "description for others")
|
||||
private java.lang.String description;
|
||||
/**发票号*/
|
||||
@Excel(name = "发票号", width = 15)
|
||||
@ApiModelProperty(value = "发票号")
|
||||
private java.lang.String invoiceNumber;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package org.jeecg.modules.business.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: extra fee option
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-11-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("extra_fee_option")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="extra_fee_option对象", description="extra fee option")
|
||||
public class ExtraFeeOption implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**英文名称*/
|
||||
@Excel(name = "英文名称", width = 15)
|
||||
@ApiModelProperty(value = "英文名称")
|
||||
private java.lang.String enName;
|
||||
/**中文名称*/
|
||||
@Excel(name = "中文名称", width = 15)
|
||||
@ApiModelProperty(value = "中文名称")
|
||||
private java.lang.String zhName;
|
||||
/**默认价格*/
|
||||
@Excel(name = "默认价格", width = 15)
|
||||
@ApiModelProperty(value = "默认价格")
|
||||
private java.math.BigDecimal defaultPrice;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.business.entity.BillingOptions;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Description: billing options
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-10-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface BillingOptionsMapper extends BaseMapper<BillingOptions> {
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package org.jeecg.modules.business.mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.business.entity.ExtraFee;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.business.vo.ExtraFeeResult;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Description: extra fees content
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-11-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface ExtraFeeMapper extends BaseMapper<ExtraFee> {
|
||||
|
||||
List<ExtraFeeResult> listWithFilters(@Param("shop") String shop,
|
||||
@Param("status") String status,
|
||||
@Param("offset") int offset,
|
||||
@Param("size") Integer pageSize,
|
||||
@Param("column") String column,
|
||||
@Param("order") String order);
|
||||
Integer countAllFees(@Param("shop") String shop,
|
||||
@Param("status") String status);
|
||||
|
||||
void updateFee(@Param("id") String id, @Param("description") String description, @Param("qty") Integer quantity, @Param("price") BigDecimal unitPrice);
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package org.jeecg.modules.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.business.entity.ExtraFeeOption;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Description: extra fees options
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-11-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface ExtraFeeOptionMapper extends BaseMapper<ExtraFeeOption> {
|
||||
|
||||
ExtraFeeOption selectByEnName(@Param("name") String optionName);
|
||||
}
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
import org.jeecg.modules.business.entity.Shop;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.business.vo.ShopPage;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
|
@ -28,4 +29,8 @@ public interface ShopMapper extends BaseMapper<Shop> {
|
|||
String getNameById(@Param("shopId") String shopId);
|
||||
|
||||
String getCodeById(@Param("shopId") String shopId);
|
||||
|
||||
List<ShopPage> listShopGroupedByClient();
|
||||
|
||||
String getIdByCode(@Param("code") String erpCode);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?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="org.jeecg.modules.business.mapper.BillingOptionsMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,59 @@
|
|||
<?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="org.jeecg.modules.business.mapper.ExtraFeeMapper">
|
||||
<select id="listWithFilters" resultType="org.jeecg.modules.business.vo.ExtraFeeResult">
|
||||
SELECT ef.id,
|
||||
ef.create_by,
|
||||
ef.create_time,
|
||||
s.erp_code as shop,
|
||||
efo.en_name,
|
||||
efo.zh_name,
|
||||
ef.description,
|
||||
ef.quantity,
|
||||
ef.unit_price,
|
||||
ef.invoice_number
|
||||
FROM extra_fee ef
|
||||
JOIN extra_fee_option efo ON efo.id = ef.option_id
|
||||
JOIN shop s ON s.id = ef.shop_id
|
||||
WHERE
|
||||
<if test="status == 0">
|
||||
ef.invoice_number IS NULL
|
||||
</if>
|
||||
<if test="status == 1">
|
||||
ef.invoice_number IS NOT NULL
|
||||
</if>
|
||||
<if test="status == null">
|
||||
ef.invoice_number IS NULL OR ef.invoice_number IS NOT NULL
|
||||
</if>
|
||||
<if test="shop != null">
|
||||
AND s.erp_code = #{shop}
|
||||
</if>
|
||||
ORDER BY ${column} ${order}
|
||||
LIMIT #{offset}, #{size}
|
||||
</select>
|
||||
<select id="countAllFees" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) AS total
|
||||
FROM extra_fee ef
|
||||
JOIN extra_fee_option efo ON efo.id = ef.option_id
|
||||
JOIN shop s ON s.id = ef.shop_id
|
||||
WHERE
|
||||
<choose>
|
||||
<when test="status == 0">
|
||||
ef.invoice_number IS NULL
|
||||
</when>
|
||||
<otherwise>
|
||||
ef.invoice_number IS NOT NULL
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="shop != null">
|
||||
AND s.erp_code = #{shop}
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateFee">
|
||||
UPDATE extra_fee
|
||||
SET unit_price = #{price},
|
||||
quantity = #{qty},
|
||||
description = #{description}
|
||||
WHERE id = #{id};
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,8 @@
|
|||
<?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="org.jeecg.modules.business.mapper.ExtraFeeOptionMapper">
|
||||
<select id="selectByEnName" resultType="org.jeecg.modules.business.entity.ExtraFeeOption">
|
||||
SELECT * FROM extra_fee_option efo
|
||||
WHERE efo.en_name = #{name};
|
||||
</select>
|
||||
</mapper>
|
|
@ -45,4 +45,19 @@
|
|||
FROM shop
|
||||
WHERE id = #{shopId};
|
||||
</select>
|
||||
<select id="listShopGroupedByClient" resultType="org.jeecg.modules.business.vo.ShopPage">
|
||||
SELECT s.erp_code as shop_code,
|
||||
c.internal_code as client_code,
|
||||
CONCAT(c.first_name, ' ' , c.surname) as client_name,
|
||||
c.currency as currency
|
||||
FROM shop s
|
||||
JOIN client c
|
||||
ON s.owner_id = c.id
|
||||
WHERE s.active = '1'
|
||||
AND c.active = '1'
|
||||
</select>
|
||||
<select id="getIdByCode" resultType="java.lang.String">
|
||||
SELECT id FROM shop
|
||||
WHERE erp_code = #{code};
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.business.service;
|
||||
|
||||
import org.jeecg.modules.business.entity.BillingOptions;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: billing options
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-10-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IBillingOptionsService extends IService<BillingOptions> {
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.modules.business.service;
|
||||
|
||||
import org.jeecg.modules.business.entity.ExtraFeeOption;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: extra fees options
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-11-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IExtraFeeOptionService extends IService<ExtraFeeOption> {
|
||||
|
||||
ExtraFeeOption getByName(String optionName);
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.jeecg.modules.business.service;
|
||||
|
||||
import org.jeecg.modules.business.entity.ExtraFee;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.business.vo.ExtraFeeParam;
|
||||
import org.jeecg.modules.business.vo.ExtraFeeResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: extra fees content
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-11-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IExtraFeeService extends IService<ExtraFee> {
|
||||
|
||||
List<ExtraFeeResult> listWithFilters(String shop, String status, Integer pageNo, Integer pageSize, String column, String order);
|
||||
|
||||
Integer countAllFees(String shop, String status);
|
||||
|
||||
void updateFee(ExtraFeeParam feeParam) throws Exception;
|
||||
}
|
|
@ -2,6 +2,8 @@ package org.jeecg.modules.business.service;
|
|||
|
||||
import org.jeecg.modules.business.entity.Shop;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.business.vo.ShopPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -22,4 +24,7 @@ public interface IShopService extends IService<Shop> {
|
|||
String getNameById(String shopId);
|
||||
|
||||
String getCodeById(String shopId);
|
||||
|
||||
List<ShopPage> listShopGroupedByClient();
|
||||
String getIdByCode(String erpCode);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.business.service.impl;
|
||||
|
||||
import org.jeecg.modules.business.entity.BillingOptions;
|
||||
import org.jeecg.modules.business.mapper.BillingOptionsMapper;
|
||||
import org.jeecg.modules.business.service.IBillingOptionsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: billing options
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-10-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class BillingOptionsServiceImpl extends ServiceImpl<BillingOptionsMapper, BillingOptions> implements IBillingOptionsService {
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.jeecg.modules.business.service.impl;
|
||||
|
||||
import org.jeecg.modules.business.entity.ExtraFeeOption;
|
||||
import org.jeecg.modules.business.mapper.ExtraFeeOptionMapper;
|
||||
import org.jeecg.modules.business.service.IExtraFeeOptionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: extra fees options
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-11-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ExtraFeeOptionServiceImpl extends ServiceImpl<ExtraFeeOptionMapper, ExtraFeeOption> implements IExtraFeeOptionService {
|
||||
@Autowired
|
||||
private ExtraFeeOptionMapper optionMapper;
|
||||
|
||||
@Override
|
||||
public ExtraFeeOption getByName(String optionName) {
|
||||
return optionMapper.selectByEnName(optionName);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package org.jeecg.modules.business.service.impl;
|
||||
|
||||
import org.jeecg.modules.business.entity.ExtraFee;
|
||||
import org.jeecg.modules.business.mapper.ExtraFeeMapper;
|
||||
import org.jeecg.modules.business.service.IExtraFeeService;
|
||||
import org.jeecg.modules.business.vo.ExtraFeeParam;
|
||||
import org.jeecg.modules.business.vo.ExtraFeeResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: extra fees content
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-11-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ExtraFeeServiceImpl extends ServiceImpl<ExtraFeeMapper, ExtraFee> implements IExtraFeeService {
|
||||
@Autowired
|
||||
private ExtraFeeMapper extraFeeMapper;
|
||||
|
||||
@Override
|
||||
public List<ExtraFeeResult> listWithFilters(String shop, String status, Integer pageNo, Integer pageSize, String column, String order) {
|
||||
int offset = (pageNo - 1) * pageSize;
|
||||
return extraFeeMapper.listWithFilters(shop, status, offset, pageSize, column, order);
|
||||
}
|
||||
@Override
|
||||
public Integer countAllFees(String shop, String status) {
|
||||
return extraFeeMapper.countAllFees(shop, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFee(ExtraFeeParam feeParam) throws Exception {
|
||||
ExtraFee fee = getById(feeParam.getId());
|
||||
if(fee == null) {
|
||||
throw new Exception("Fee not found");
|
||||
}
|
||||
extraFeeMapper.updateFee(feeParam.getId(), feeParam.getDescription(), feeParam.getQuantity(), feeParam.getUnitPrice());
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.business.service.impl;
|
|||
import org.jeecg.modules.business.entity.Shop;
|
||||
import org.jeecg.modules.business.mapper.ShopMapper;
|
||||
import org.jeecg.modules.business.service.IShopService;
|
||||
import org.jeecg.modules.business.vo.ShopPage;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -48,4 +49,14 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements IS
|
|||
public String getCodeById(String shopId) {
|
||||
return shopMapper.getCodeById(shopId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShopPage> listShopGroupedByClient() {
|
||||
return shopMapper.listShopGroupedByClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdByCode(String erpCode) {
|
||||
return shopMapper.getIdByCode(erpCode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.modules.business.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ExtraFeeParam {
|
||||
private String id;
|
||||
private String shop;
|
||||
private String optionId;
|
||||
private Integer quantity;
|
||||
private BigDecimal unitPrice;
|
||||
private String description;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package org.jeecg.modules.business.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ShopPage {
|
||||
private String shopCode;
|
||||
private String clientCode;
|
||||
private String clientName;
|
||||
private String currency;
|
||||
}
|
Loading…
Reference in New Issue