fix:载体实体提交

pg_adapter
wangxy 8 months ago
parent 87c55747a3
commit ba0282804d

@ -1,11 +1,19 @@
package com.ruoyi.web.controller.carrier; package com.ruoyi.web.controller.carrier;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.carrier.TdCarrier;
import com.ruoyi.web.controller.manager.CarrierManager; import com.ruoyi.web.controller.manager.CarrierManager;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* packageName com.ruoyi.web.controller.carrier * packageName com.ruoyi.web.controller.carrier
@ -20,10 +28,108 @@ import javax.annotation.Resource;
@RequestMapping("/system/carrier") @RequestMapping("/system/carrier")
public class CarrierController extends BaseController { public class CarrierController extends BaseController {
private String prefix = "system/carrier";
@Resource @Resource
private CarrierManager carrierManager; private CarrierManager carrierManager;
@RequiresPermissions("system:carrier:view")
@GetMapping()
public String carrier() {
return prefix + "/carrier";
}
/**
*
*/
@RequiresPermissions("system:carrier:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TdCarrier tdCarrier) {
startPage();
List<TdCarrier> carriers = carrierManager.selectTdCarrierList(tdCarrier);
return getDataTable(carriers);
}
/**
*
*/
@GetMapping("/add")
public String add() {
return prefix + "/add";
}
/**
*
*/
@RequiresPermissions("system:carrier:add")
@Log(title = "国家秘密载体", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TdCarrier tdCarrier) {
return toAjax(carrierManager.saveOrUpdate(tdCarrier));
}
/**
*
*/
@RequiresPermissions("system:carrier:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") String id, ModelMap mmap) {
TdCarrier tdCarrier = carrierManager.selectTdCarrier(id);
mmap.put("tdCarrier", tdCarrier);
return prefix + "/edit";
}
/**
*
*/
@RequiresPermissions("system:carrier:edit")
@Log(title = "国家秘密载体", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TdCarrier tdCarrier) {
return toAjax(carrierManager.saveOrUpdate(tdCarrier));
}
/**
*
*/
@RequiresPermissions("system:carrier:detail")
@GetMapping("/detail/{id}")
public String detail(@PathVariable("id") String id, ModelMap mmap) {
TdCarrier tdCarrier = carrierManager.selectTdCarrier(id);
mmap.put("tdCarrier", tdCarrier);
return prefix + "/detail";
}
/**
*
*/
@RequiresPermissions("system:carrier:remove")
@Log(title = "涉密场所", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids) {
return toAjax(carrierManager.deletedTdCarrierByids(ids));
}
/**
*
*/
@GetMapping ("/updateStatus/{id}/{status}")
@ResponseBody
public AjaxResult updateStatus(@PathVariable("id") String id,@PathVariable("status") String status) {
return toAjax(carrierManager.updateStatus(id,status));
}
} }

@ -1,9 +1,16 @@
package com.ruoyi.web.controller.manager; package com.ruoyi.web.controller.manager;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.text.CharSequenceUtil;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.carrier.TdCarrier;
import com.ruoyi.system.service.carrier.TdCarrierService; import com.ruoyi.system.service.carrier.TdCarrierService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/** /**
* packageName com.ruoyi.web.controller.manager * packageName com.ruoyi.web.controller.manager
@ -19,4 +26,40 @@ public class CarrierManager {
@Resource @Resource
private TdCarrierService carrierService; private TdCarrierService carrierService;
public List<TdCarrier> selectTdCarrierList(TdCarrier tdCarrier) {
return carrierService.selectTdCarrierList(tdCarrier);
}
public boolean saveOrUpdate(TdCarrier tdCarrier) {
if (CharSequenceUtil.isNotBlank(tdCarrier.getId())) {
tdCarrier.setUpdateBy(ShiroUtils.getSysUser().getLoginName());
tdCarrier.setUpdateTime(new Date());
} else {
tdCarrier.setCreateBy(ShiroUtils.getSysUser().getLoginName());
tdCarrier.setCreateTime(new Date());
}
return carrierService.saveOrUpdate(tdCarrier);
}
public TdCarrier selectTdCarrier(String id) {
return carrierService.getById(id);
}
public boolean deletedTdCarrierByids(String ids) {
List<String> list = Arrays.asList(Convert.toStrArray(ids));
return carrierService.removeByIds(list);
}
public boolean updateStatus(String id,String status) {
return carrierService.lambdaUpdate()
.eq(TdCarrier::getId,id)
.set(TdCarrier::getStatus,status)
.update();
}
} }

@ -28,6 +28,12 @@ public class TdCarrier extends BaseEntity {
*/ */
private String carrierCount; private String carrierCount;
/**
*
*/
private String carrierName;
/** /**
* *
*/ */

@ -3,6 +3,8 @@ package com.ruoyi.system.mapper.carrier;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.carrier.TdCarrier; import com.ruoyi.system.domain.carrier.TdCarrier;
import java.util.List;
/** /**
* @author 13560 * @author 13560
* @description td_carrier()Mapper * @description td_carrier()Mapper
@ -11,6 +13,9 @@ import com.ruoyi.system.domain.carrier.TdCarrier;
*/ */
public interface TdCarrierMapper extends BaseMapper<TdCarrier> { public interface TdCarrierMapper extends BaseMapper<TdCarrier> {
public List<TdCarrier> selectTdCarrierList(TdCarrier tdCarrier);
} }

@ -3,6 +3,8 @@ package com.ruoyi.system.service.carrier;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.system.domain.carrier.TdCarrier; import com.ruoyi.system.domain.carrier.TdCarrier;
import java.util.List;
/** /**
* @author 13560 * @author 13560
* @description td_carrier()Service * @description td_carrier()Service
@ -10,4 +12,7 @@ import com.ruoyi.system.domain.carrier.TdCarrier;
*/ */
public interface TdCarrierService extends IService<TdCarrier> { public interface TdCarrierService extends IService<TdCarrier> {
public List<TdCarrier> selectTdCarrierList(TdCarrier tdCarrier);
} }

@ -3,9 +3,13 @@ package com.ruoyi.system.service.carrier.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.carrier.TdCarrier; import com.ruoyi.system.domain.carrier.TdCarrier;
import com.ruoyi.system.mapper.carrier.TdCarrierMapper; import com.ruoyi.system.mapper.carrier.TdCarrierMapper;
import com.ruoyi.system.mapper.place.TdPlaceMapper;
import com.ruoyi.system.service.carrier.TdCarrierService; import com.ruoyi.system.service.carrier.TdCarrierService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/** /**
* @author 13560 * @author 13560
* @description td_carrier()Service * @description td_carrier()Service
@ -15,6 +19,13 @@ import org.springframework.stereotype.Service;
public class TdCarrierServiceImpl extends ServiceImpl<TdCarrierMapper, TdCarrier> public class TdCarrierServiceImpl extends ServiceImpl<TdCarrierMapper, TdCarrier>
implements TdCarrierService { implements TdCarrierService {
@Resource
private TdCarrierMapper carrierMapper;
@Override
public List<TdCarrier> selectTdCarrierList(TdCarrier tdCarrier) {
return carrierMapper.selectTdCarrierList(tdCarrier);
}
} }

@ -9,6 +9,7 @@
<result property="carrierCount" column="carrier_count" jdbcType="VARCHAR"/> <result property="carrierCount" column="carrier_count" jdbcType="VARCHAR"/>
<result property="carrierLevel" column="carrier_level" jdbcType="VARCHAR"/> <result property="carrierLevel" column="carrier_level" jdbcType="VARCHAR"/>
<result property="carrierExtent" column="carrier_extent" jdbcType="VARCHAR"/> <result property="carrierExtent" column="carrier_extent" jdbcType="VARCHAR"/>
<result property="carrierName" column="carrier_name" jdbcType="VARCHAR"/>
<result property="carrierAlliance" column="carrier_alliance" jdbcType="VARCHAR"/> <result property="carrierAlliance" column="carrier_alliance" jdbcType="VARCHAR"/>
<result property="carrierSecret" column="carrier_secret" jdbcType="VARCHAR"/> <result property="carrierSecret" column="carrier_secret" jdbcType="VARCHAR"/>
<result property="carrierNumber" column="carrier_number" jdbcType="VARCHAR"/> <result property="carrierNumber" column="carrier_number" jdbcType="VARCHAR"/>
@ -54,6 +55,31 @@
maintain_date,destory_depart,destory_user, maintain_date,destory_depart,destory_user,
destory_date,destory_manner,status, destory_date,destory_manner,status,
create_by,create_time,update_by, create_by,create_time,update_by,
update_time,remark update_time,remark,carrier_name
</sql> </sql>
<select id="selectTdCarrierList" resultType="com.ruoyi.system.domain.carrier.TdCarrier">
select <include refid="Base_Column_List"/> from td_carrier
<trim prefix="where" prefixOverrides="and|or">
<if test="carrierName!=null and carrierName!=''">
AND carrier_name LIKE concat('%',#{carrierName},'%')
</if>
<if test="carrierLevel!=null and carrierLevel!=''">
AND carrier_level = #{carrierLevel}
</if>
<if test="carrierExtent!=null and carrierExtent!=''">
AND carrier_extent = #{carrierExtent}
</if>
<if test="carrierSecret!=null and carrierSecret!=''">
AND carrier_secret = #{carrierSecret}
</if>
<if test="carrierNumber!=null and carrierNumber!=''">
AND carrier_number = #{carrierNumber}
</if>
<if test="status!=null and status!=''">
AND status = #{status}
</if>
</trim>
ORDER BY create_time DESC
</select>
</mapper> </mapper>

Loading…
Cancel
Save